Home > Ask the Software Quality Experts > Software Testing and Quality Assurance Questions & Answers > Is functional testing sufficient to determine code coverage?
Ask The Software Quality Expert: Questions & Answers
EMAIL THIS

Is functional testing sufficient to determine code coverage?

Karen N. Johnson EXPERT RESPONSE FROM: Karen N. Johnson

Pose a Question
Other Software Quality Categories
Meet all Software Quality Experts
Become an Expert for this site


Software quality news and advice
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


>
QUESTION POSED ON: 16 March 2009
Is functional testing (user acceptance tests, business transaction flows, +ve input tests, -ve input tests) sufficient to determine code coverage? Do we see any additional coverage when we do nonfunctional testing (for example, load testing with the same inputs used in functional testing)? If so, how?

>
Code reviews can reveal paths and conditions that the application code has been written to address. Functional testing, even with the addition of many types of input and user acceptance testing, is not the same as determining code coverage. You'll have to decide what goal you are trying to accomplish -- are you trying to build functional testing and/or user acceptance testing? Do you need code reviews? Do you need to determine code coverage? One does not replace the other.

Let's use an example to discuss the difference between functional testing and code coverage. We'll use a Web application with shopping cart functionality and think about code conditions that may have been built. Then we can look at functional test scenarios versus code coverage to consider an example where the gap between testing and code coverage can be understood.

Very specifically, to keep this example manageable, let's think about code that may be built to address a user whose credit card on file may include the following conditions:

  1. Credit card is valid and not expired
  2. Credit card is valid and expired
  3. Credit card is valid and will expire this month

In functional testing, a tester may consider conditions 1 and 2 but might not consider or realize condition 3. Let's suppose that the code has been written to show a warning message to the user that their credit card will expire this month. The user can shop with the card until the first day of the next month but perhaps throughout the month, the application will show a warning message to the user that the card on file will expire at the end of the month. If a tester isn't aware of this condition, then it might not be a scenario that would be addressed through either functional or user acceptance testing.

"Sufficient" is an interesting word. Is it sufficient to test just conditions 1 and 2 listed above? If no change occurs in processing the order, does the testing team feel the need to test condition 3? What's sufficient? An understanding of the code would reveal there was a branch in the code that checked for condition 3. What if on condition 3, the warning message shown to the user was incorrect or had an embarrassing typo? The perspective of "sufficient" seems to shift when a defect is missed in production.

I'd prefer to think in terms of "realistic" versus sufficient. It seems there will never be enough time to test, so many conditions, so many variables, so many browsers and so many operating systems can add up to more testing than there is ever time for. What are likely or realistic conditions to test for? And what conditions are there to test that I might not be aware of without insight into how the code was built?

This is why I spend time with the developers and system architects to understand the conditions that have been coded. Unless I'm involved in a code review, it's not likely I will be mindful of all the conditions that have been coded for. I try to gather all the possible test conditions I can think of and solicit ideas from others on the team. Then I pare that entire list of testing down to what is realistic, thinking of risk and likelihood all the while.

Can you gain coverage by performing other forms of testing -- other forms such as load and stress testing as well as testing with different data? Absolutely. Let's consider that you were able to get access to a production copy of data and to test with that data -- now you increase the likelihood of finding a user whose credit card will expire this month. In the case of stress testing, you might find a defect such that the credit card authorization system can't provide authorization rapidly enough for "reasonable" performance when a number of users submit their order at the same time. (I put the word "reasonable" in quotes because I recognize this is a vague reference and reasonable has to be determined, or at least discussed within your project team. And it may be that "reasonable" is never agreed upon throughout the team.)

A final comment on trying to make the testing realistic: It might be that you identify more tests than can ever be executed. I've been in that situation numerous times. In one environment, I agreed with my project stakeholders what would be tested for every release. Additionally, we had some test conditions -- especially stress testing -- that we only executed every few releases, with an awareness across the team that this was the case. No one on the team thought we were covering everything; we had all accepted that covering everything wasn't possible. Instead we had agreed we would focus on conditions that were highly likely with a strong understanding of where the risks were. We didn't focus on sufficient, we focused on realistic.


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google



RELATED CONTENT
Software Testing and Quality Assurance
Why do performance testers write new scripts so often?
How to create performance testing workload models
Fixing Web application performance troubleshooting problems
Expert advises on implementation of Selenium IDE for effective software testing
When should regression testing occur in an automated test plan?
Achieving peak performance in integration testing
Getting answers about OpenSTA script problems
Defining core software regression tests
Breaking in functionality on UI application pages
Where to find good methodology guides for software testing

Functional software testing
Running your first load test with JMeter
Testing strategies for complex environments
Software Testing Ezines
Improving software testing productivity using record-playback
How to test usability for a positive user experience
Data warehouse/BI performance testing tool recommendations
Is online application testing for smartphones different from other software testing?
Why do performance testers write new scripts so often?
The case for software tester, analyst partnerships
Fixing Web application performance troubleshooting problems

Software performance, load and stress testing
APM plus load testing a winning equation for Raymond James
AVIcode upgrades its end-user experience APM product
Running your first load test with JMeter
Recording and running software load tests with JMeter
Performance testing tools - Commercial, less expensive and free
Easing software performance testing and usability modeling pressures
Software Testing: New software testing technologies bring new challenges
Drilling deep into performance testing at STPCon
STPCon: Do reality checks on performance test products, panelists advise
Ways to approach application performance testing on a tight budget

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
context-driven testing  (SearchSoftwareQuality.com)
functional programming  (SearchSoftwareQuality.com)
shotgun debugging  (SearchSoftwareQuality.com)
Wirth's Law  (SearchSoftwareQuality.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice



Software Quality - Software Maintenance, Software Requirements, Software Standards
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2006 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts