Functional testing: Unit testing, integration testing and beyond

Functional testing: Unit testing, integration testing and beyond

Can functional testing be replaced or significantly reduced by integration testing? For example, by using a CI server?

    Requires Free Membership to View

    When you register, you'll receive targeted emails designed to keep you informed of the most relevant information on Agile development, application security, testing & QA, software requirements, and more.

    Hannah Smalltree, Editorial Director

    By submitting your registration information to SearchSoftwareQuality.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchSoftwareQuality.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

Unit tests are tests built by developers; unit tests are designed to test code at the smallest practical "unit" of functioning code. Tests designed to address units of code that work together are integration tests. Integration tests are also built by developers. Examples help explain so much more than definitions so let me create an example to step through.

Imagine a Web application that requires a login. To keep the example simple, let's imagine a login page that requires an account name and password. A unit test might be built to check the field length of both fields and maybe that the login button doesn't become enabled until a value of the required length is entered in both fields. An integration test, in this example, might be checking that the user views a home page after entering valid values and pressing the login button. So now let's consider the original question and think through what additional tests a functional tester might execute given the unit and integration tests that have been outlined.

Here are a few functional test ideas given this situation:

  • First a happy path confirmation test: Can a valid user enter valid values in both fields and login?
  • Followed by a process checkpoint: Once the user logs in, should there be a personalized greeting on the home page? Let's suppose "Welcome Karen" should appear. Does it appear?

Here are a few more tests:

  • Does a user who has visited the site previously have a cookie stored on the PC and if so, what information is stored in the cookie?
  • And how does having a cookie affect or not affect the login and home pages?
  • Can a user that has been inactivated log in?
  • What if a user forgets their password? Is there reset password functionality available?
  • What if the user enters an invalid value or no value in the field? What error messaging appears? Are the messages consistent with other error messages in the application?
  • What if the user has lost Internet connection and the home page has been cached in their browser? What messaging appears on an attempt to login with connection?
There are more tests I can think to execute but I'll stop here.

There are more functional tests and ideas testers can think of than developers are likely to build at either unit or integration level tests. From afar, it would seem that unit and integration tests must be enough and why spend more resources testing? But these examples hopefully illustrate that in fact, there is plenty of testing yet to be addressed through functional testing even after unit and integration testing.

Functional, integration and unit testing:
How to do integration testing

Better software through debugging and unit testing

Six functional tests to ensure software quality

Using a continuous integration server may keep unit and integration tests up to date and passing but it's still the same limited tests being executed against the code. The same would be true if automated functional tests were built -- time might be saved executing the tests but the only tests executed would be whatever tests were built. A functional tester who's engaged with the application and has unique ideas and doesn't execute testing in a mechanical rote approach will continue to find bugs.

This was first published in June 2008