Netsparker Web Application Security Scanner

Test Coverage in Software Testing

Test Coverage is an important part in Software testing and Software maintenance and it is the measure of the effectiveness of the testing by providing data on different items.

What is Test Coverage in Software Testing?

Amount of testing performed by a set of test cases is called Test Coverage. By amount of testing we mean that what parts of the application program are exercised when we run a test suite. In other words, test coverage is defined as a technique which determines whether our test cases are actually covering the application code and how much code is exercised when we run those test cases. When we can count upon some things in an application and also tell whether the test cases are covering those things of application, then we can say that we measure the coverage. So basically the coverage is the coverage items that we have been able to count and see what items have been covered by the test. The test coverage by two test cases executed can be the same but the input data of 1 test case can find a defect while the input data of 2 nd cannot. So with this we understand the 100% coverage does not mean 100% tested.

Mainly more focus is put on getting code coverage information by code based testing and requirement based testing but not much stress is put on analysing the code coverage by covering maximum items in code coverage.

Test Coverage in Software Testing

Measures Software Testing Completeness?

Requirements, Structure and Architecture are three software abstractions which are used to develop and build the software. These can be described as the “size of the software”. With these we can determine the completeness criteria with an ease. These are measure of software testing.

We will understand each of these now:

1) Requirements Coverage:

=> Has the software been tested against all requirements for the normal range of use?

=> Has the software been tested against all requirements for abnormal or unexpected usage?

=>Techniques of requirement coverage:

  • Normal Range Coverage of Software Requirements
  • Normal Range Coverage of Software Design
  • Robustness Coverage of Software Requirements
  • Robustness Coverage of Software Design

2) Structural Coverage:

=>Has each element of the software been exercised during testing?

=>Techniques of structural coverage: Test Coverage is a structural coverage testing approach. These techniques come under test coverage.

  • Code Statements
  • Decisions
  • Conditions and Decisions

3) Architectural Coverage:

=>Have the actual control and data links been utilised during testing?

=>Techniques of Architectural coverage:

  • Data Paths
  • Control Links


How we can measure the Test Coverage?

Test coverage can be best measured with the following  3 things:

  1. By mapping the requirements to the test cases.
  2. By the test case status.
  3. By code coverage analysis.


Why do we do Test Coverage?

We perform Test coverage analysis for the following reasons.

  1. To find the areas in specified requirement which is not covered by the test scenarios and cases.
  2. By determining the test coverage we can create more test cases to increase our test coverage.
  3. By performing the test coverage we can measure how much testing is covered. This indirectly means the check on quality of the application.
  4. We can also identify some useless test cases which don’t have meaning in being executed and thus omit them.
  5. Testing Life becomes smooth by managing the risk based testing approach.
  6. Traceability between the requirements and the test cases can be achieved by this technique.
  7. Impact analysis and change tracking can be determined if we have proper test coverage.


What are the advantages of Test coverage Analysis?

By Test coverage we can actually determine which part of the code was touched for the deployment/release.

  1. We can prevent defect leakage using Test coverage analysis.
  2. Defects can be prevented by this early stage of application life cycle.
  3. We can keep time, resources, cost, scope under control with this technique.
  4. The test coverage analysis can determine the decision points and important path made in the application which helps us to increase the test coverage.
  5. With this we can check the paths of the code which are not tested.
  6. We can determine the quality of the testing we are performing.
  7. We can find the easily gaps in requirements, test cases and defects at an early level and code level.


What are the disadvantages of Test Coverage in Software Testing?

  1. In test coverage we can find the gaps in application code that has been written. There is no measurement of the part of the software that is not coded. Thus it has coverage only of the written part.
  2. If the there is a specification which is not implemented or there might be a specification which is now removed, then this technique will not tell anything about it. It says only about the structure code which is already present.


How do we perform Test Coverage Analysis?

  1. Test Coverage can be implemented by Static testing techniques. These test techniques include peer reviews, code inspections and code walkthroughs.
  2. We can convert the adhocs defects into test cases and analyse test coverage.
  3. We can use code level tools and automation to achieve test coverage at unit level.
  4. We can use test management tools to perform functional test coverage which will establish traceability between, requirements, defects and test cases.
  5. We can use Bi- directional traceability matrix to achieve test coverage.

Best Practices of Test Coverage in Software Testing!

  1. We should perform maintenance activities and cleanup activities at frequent intervals of time.
  2. We should maintain metrics to measure the test coverage percent.
  3. Usage of test management tools is good practice to have control over all aspects of coverage from requirements, test cases and defects.
  4. Quality gate mechanism should be proper to verify the results.


Over to you:

In today’s article we learned about “Test Coverage in Software Testing“. If you are not regular reader of this website then highly recommends you to Sign up for our free email newsletter!! Sign up just providing your email address below:

Enter your email address:

Check email in your inbox for confirmation to get latest updates Software Testing for free.

Happy Testing!!!

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>