Problem solve Get help with specific problems with your technologies, process and projects.

What is the difference between code coverage and test coverage?

Code coverage and test coverage metrics are both measurements that can be useful to assess the quality of your application code. Code coverage is a term to describe which application code is exercised when the application is running. Test coverage refers to metrics in an overall test-plan. In this expert response, you'll learn how quality assurance professionals use both of these metrics effectively.

What is the difference between code coverage and test coverage?

Code coverage is a term that is used to describe how much application code is exercised when an application is running. Test coverage is often used to describe test cases that are written against the requirements document. Both are analytics which may be useful for quality assurance personnel to get an indication of how thoroughly an application has been tested. Let me explain a little bit more about how each of these can be used. 

Measuring code coverage is a technique for understanding exactly which application code is being exercised. There are tools that can be used to indicate which code is being executed when running through test cases, for example. When I was a developer at IBM, part of what was required at IBM was to write unit test cases that would exercise every code path. If there was a code path that would only be executed in the case of an error condition, for example, I had to write a test case that would create that error condition and then verify that the appropriate error message was displayed. This type of testing is also referred to as "white-box" testing. You need to see the application code in order to assess the coverage. 

Test coverage often refers to a set of test cases that is written against the requirements specifications. This would be "black-box" testing. It is not necessary to see the code in order to write the test cases. Once a document is written that describes all the test cases then test groups may refer to a percentage of the test cases that were run, that passed, failed, etc. These types of metrics can be referred to as test coverage metrics. Testing the code paths, or code coverage testing, is often done more as a part of unit test by the developer. Overall test coverage is often used by QA groups to indicate test metrics and coverage according to the test plan.

Next Steps

Discover the best test management software for your business

Dig Deeper on Topics Archive

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.