Topic: Ruby on rails difference between Integration and Functional testing

I am wondering, if I use Integration testing, is functional testing necessary? And what about Acceptance testing? I am struggling to understand, if I can stick to Integration testing and then just forget about Functional testing?

Another thing is, Functional and Integration testing seem very similar do they test the same things?

Thank you smile

Re: Ruby on rails difference between Integration and Functional testing

Ahh, my least favorite topic, test.  First, I must confess that I don't programmatically test my rails stuff.   I'm just now getting to the point where I have to start,  but I hate it so much I've been procrastinating.  Long ago, (1984 thru 1987)  I managed a large project with 9 developers,  and testing was such a pain in the butt, it traumatize me for life,  all we had back then was sccs and make.  When I started using rails and saw how test was actually baked in,  it made me think, 'Great, testing will be much simpler than the last time I went through it',  which led to sever procrastination.

Anyway,  Functional Testing (we used to call it Unit test),  tests the smallest bit's of functionality,  i.e.  you have a helper function called calcRate,  which given two arguments, calculates some third specific value.   The order of the arguments is important.  So you unit test that function,  and verify that if called with values  1 and 2,  it returns 3.

Integration testing tests that your units work when used together (when integrated to each other.)  It is the next level up from Unit test.  For example,  you've verified that  calcRate works stand alone,  but calcRate is called multiple places in your app,  what if one programmer reversed the arguments,  called it with 2,1 instead of 1,2.  Integration testing is where you'd detect that error.

If you were to decide to only do one or the other,  Integration testing is probably where you'll get the most bang for your buck,  especially if there is more than one developer involved in the project.  But you should still probably Unit test stuff that is crucial,  i.e. balanceDue.

Last edited by BradHodges (2012-04-08 11:27:00)

Joe got a job, on the day shift, at the Utility Muffin Research Kitchen, arrogantly twisting the sterile canvas snout of a fully charged icing anointment utensil.

Re: Ruby on rails difference between Integration and Functional testing

Thank you BradHodges. Very helpful. Now I understand the difference between functional (unit) testing and integration!!

Re: Ruby on rails difference between Integration and Functional testing

Brad, I think you may have misunderstood "unit testing" and "functional testing" (they are not the same thing).

Unit testing is testing very small, relatively indivisible parts of your application, like a method of a class. It is in essence, as small "unit" of your application.

Functional testing is testing from the user's perspective - for example, checking that a filling in the login form with valid details and submitting the form will actually log the user in. Functional tests usually touch many areas of the application, if any one of them fails, your functional test will fail.