Coverage Techniques in Software Testing

by Nataliia Vasylyna | November 9, 2011 10:00 am

Note: this atricle was updated in July 2019.

How to cover everything with your attention and control? In software testing, we use test coverage to define the percent of executed tests. Test coverage is a measurement in Software Testing that shows the percentage of product functionality which is tested and defines the amount of the entire testing circle. It determines which branches of the program were examined and which conditions and setting were considered.

There are various possible paths between the initial and final stages of software application testing[1]. Since there are rarely enough resources to test every path, a tester can use white-box logic coverage techniques to select the code coverage testing[2] that is the most likely to help identify the yet undiscovered, relevant defect[3]. Let`s reveal more about test coverage techniques.

How to Involve Coverage Technique

Test coverage finds requirements which are not included to test cases. It provides a quality check by measurement of the executed tests’ amount (unit test code coverage). Coverage helps to identify useless test cases which do not increase the testing productiveness and helps to create additional ones.
To choose the right coverage technique, it is important to consider the fact that there may be undiscovered defects which escaped the testing. A tester needs to define the potential impact of such a bug on the product functionality and predict its source. The type of test coverage should be chosen basing on the harm of possible undiscovered bug.

The minimum needed test coverage is statement coverage, path coverage, and decision coverage. If the part of the code is not tested, there is no opportunity to detect a bug during tests. The statement coverage plays a base for adding further, more complicated techniques.

The optimal way of providing the complete coverage is to make test case basing on each certain defect. Transformation of each independent bug into an element of a definite testing strategy[4] increases the probability to avoid undiscovered defects.

Why Test Coverage is Valuable

Drawbacks:

Calculation of Test Coverage

You need to perform the following steps to get the coverage formula:

  1. Firstly, consider all code lines which are under testing (marked as Y).
  2. Secondly, take the number of code lines from all test cases (marked as X).
  3. Finally, you have to divide X by Y and multiply the result by 100. After these simple calculations, you know the % of your test coverage

For example:

  1. There are 500 code lines.
  2. There are 50 code lines of executed test cases.
  3. As a result, the percent of coverage is defined as: (50 / 500) * 100 = 10%.

Test Coverage Techniques

There are several areas for test coverage which are essential to examine with the respective coverage techniques:

test coverage techniques

Product coverage

The scope of this technique is to monitor which parts are tested using test coverage tools, and which are still being not examined.

Example: The app must be capable to respond to the unusual actions of the user. It must be checked whether the multiple users can interact with a program at the same time. It is also important whether the application is able to function properly while other apps are opened on the same device. If at least one of these elements is not tested, it is impossible to define the testing as complete.

Risk coverage

You can not consider the product as completely tested if there was no examination of associated risks and their sources. Even if you ensure the proper work of a function, it is important to predict whether it is possible to face the failure in the future, how big the probability is, and what may be the potential reason of failure.

Example: Such app as e-commerce web site [5]can be tested carefully, and each independent function can be completely verified. However, a tester can miss the question of simultaneous access of multiple users, which may cause failure even in case of successful interaction with each certain user.

Requirements coverage

This stage aims to define whether the developed product matches the expected requirements and is capable to perform its purpose.

Example: The subject of testing is a chat application, and each certain function works properly. But requirement documents specify that multiple users have to be able to interact with a program without failures, and this feature was not examined. In this case, we can not consider such a product as completely covered.

Compatibility coverage

It defines the integration of the program with different browsers and platforms. It shows the issues in cooperation with devices that have various settings and configurations.

Conclusion

It is not always right to think that the more tests are performed, the bigger is the probability of high quality. In fact, if you just test a lot but without a reliable strategy, it will only take the tons of time. That is why you need effective methods to check the execution and track the progress of reaching your goal, which is possible due to the coverage techniques. The right approach will allow you to ensure the proper direction of your testing and save your time and efforts.

QATestLab hopes that the described tips will become good point markers on your path to the expected end result.

Learn more from QATestLab

Related Posts:

Endnotes:
  1. software application testing: https://qatestlab.com/solutions/by-focus-area/mobile-applications/
  2. coverage testing: https://blog.qatestlab.com/2011/03/31/ways-to-measure-test-coverage/
  3. defect: https://blog.qatestlab.com/2011/10/11/main-types-of-defects-in-software-testing/
  4. testing strategy: https://blog.qatestlab.com/2014/04/15/what-aspects-must-testing-strategy-comprise/
  5. e-commerce web site : https://blog.qatestlab.com/2018/12/18/ecommerce-christmas-rush/
  6. Latest QA Trends: Key Insights Into Test Automation: https://blog.qatestlab.com/2024/12/19/test-automation-insights-and-trends/
  7. AI In Test Automation: From Costs To Benefits: https://blog.qatestlab.com/2024/11/27/test-automation-and-ai-benefits/
  8. Software Development (Doesn’t) Need Independent QA: https://blog.qatestlab.com/2024/11/14/software-development-doesnt-need-independent-qa/

Source URL: https://blog.qatestlab.com/2011/11/09/coverage-techniques-in-software-testing/