Features and capabilities of Code Coverage for Eclipse
Code Coverage collects run-time execution data from the () and () debuggers, then allows you to view code coverage results online. The graphical interface allows you to do the following:
- Identify what percentage of an application's code was executed and how often.
- Determine what percentage of modified code in a program has not been executed.
- Document testing efforts and create a report of program test execution.
The benefit of using Code Coverage is that it identifies the programs that have a high risk of failure related to untested code, and simplifies creating additional tests. For example, using Code Coverage you could identify the 10 programs within a payroll system that have the greatest risk of failure.
The Code Coverage repository stores the results of code coverage test sessions. From the repository, you can generate reports that document the thoroughness of testing. Filters enable you to get data that meet specific reporting criteria. These filters can be used to report coverage results on specific sections of the source code, such as date or currency fields, to help ensure that the changed code has been tested.
Code Coverage also relates relative risk and the percent of unexecuted code to the program’s complexity. For example, an aggregate of regression tests may indicate that 60% of an application has been executed. Based on this, you can determine whether this is an acceptable level of testing. It may be acceptable if all sections of code that have been changed have been tested; it may not be if modified code remains unexecuted. This is where the use of filtering and the patented Relative Risk metric come in. They allow you to determine the percentage of changes that have been tested.
Relative risk gives you an idea of where the risk lies in the testing of a program. It ranks each program based on a combination of the following factors, which contribute to risk:
- Complexity (based on the number of unique paths through a procedure, and therefore the minimum number of test cases that should be executed)
- Filter information
- Execution counts, if available
- Verb types
- Measure of percentage of code still unexecuted
Program risk measurements are listed in the report view. While it is always risky to not test to 100%, there often is not enough time to do so. Code Coverage helps you determine the level of risk to take in terms of testing—or not testing—code as a deadline approaches. This allows testing efforts to focus on the right parts of the program.