Test coverage
- a criterion that displays the quality factor of software testing services. It characterizes the completeness of test code coverage or requirements for it.The main approach to assessment is the formation of a test pool. The value of the test coverage of the code is directly dependent on the number of selected verification options for it.
The multitasking and versatility of modern software makes it impossible to organize test coverage with an indicator of 100%. So for the maximum coverage of the tested code, special techniques and tools have been developed.
There are three approaches for assessing the quality and expression of test coverage in numerical representation depending on the area of verification: coverage of requirements, code coverage, and coverage based on control flow analysis. Read more about each.
Requirements Coverage
Using the trace matrix, we consider the test coverage of the requirements put forward by the program.
The formula for the assessment is as follows:
Tcov = (Lcov / Ltotal) * 100.
The result is expressed as a percentage.
Explanation of variables:
Tcov - test coverage;
Lcov - the number of requirements selected for testing;
Ltotal - The total number of claims claimed.
. One way to simplify the task is to divide the code requirements into subsections. For this, it is important to conduct a thorough analysis of them. Subsequently, the subsection is attached to the validation tests. The sum of these relationships is called the "trace matrix." It allows you to track verified requirements for a specific test case.
It makes no sense to use tests without regard to requirements. At the same time, if the requirement is not tied to verification, its verification will not be carried out. As a result, it will not be possible to judge the level of implementation of the requirement in program code. Since the multitasking of modern software entails some standardization, expressed in general, for standard conditions, solutions, it makes sense to use standard test design techniques.
Learn more about Performance testing services
Code Coverage
In this case, areas of the program code that were not covered by the verification process itself are tracked.The formula for the assessment looks like this:
Tcov = (Ltc / Lcode) * 100%
The result is expressed as a percentage.
Variables:
Tcov - test coverage;
Ltc - the number of lines of code covered by the check;
Lcode - the total number of lines of code.
Standard tools have been developed for routine work. For example, Clover. This product tracks and provides information about the timing of occurrences during testing.
Data analysis allows you to significantly expand the coverage area, since duplicate checks and cases of loss of code sections from testing are revealed.
This technique of coating optimization is used in the analysis according to the principle of "white box" and in the strategies of unit, integration, system testing.
Not knowing the internal structure of the code, as can be assumed from the formula, this is not the best choice for implementing black box testing. There will be difficulties in configuring, installing. We will have to attract the authors of the product.
Testing Control Flows
This approach is also more convenient when implementing the principle of“white box”. In this case, the ways of executing software code are analyzed, which is implemented by the development and implementation of test cases to cover testing of these same paths. As in the first case, there is a special principle that facilitates coverage of the desired area.
The control flow graphs are used. According to the ratio of the number of entry points and exit points, three components are distinguished:
- a process block (one entry and exit point).
- alternative point (there is more than one exit point per entry point).
- connection point (there is more than one entry point per exit point).
Validation of control flows involves several levels of coverage:
Level | Name | Description |
Zero | Without name | Detailed testing is entrusted to users. The tester himself conducts a shallow standard research. |
First | Coverage (P.) of operators | Each code statement must be involved in the test at least once. |
Second | P. branches | Each branch point of the algorithm code is checked at least once |
Third | P. conditions | If the condition has two options (TRUE or FALSE) of the solution, it must be satisfied once for each case. |
Fourth | P. conditions and branches | A check is provided for each condition and branch. |
Fifth | P. set of conditions | The total application of levels from the second to the fourth. |
Sixth | P. infinite number of ways | Sometimes the number of paths stubbornly tends to infinity in a loop. Then a limited set of cycles is subject to verification. |
Seventh | P. Ways | All paths are subject to verification without exception |
No comments:
Post a Comment