Measuring Test Coverage
Use
You can perform test coverage measurements from eCATT in the ABAP Coverage Analyzer (transaction SCOV). The ABAP Coverage Analyzer is a tool for test and quality assurance that monitors the execution of ABAP programs across the system at the statement level. By integrating eCATT and the ABAP Coverage Analyzer, you can determine the test coverage, that is, you can find out if an ABAP program is completely covered by the test or if there are code lines that have not yet been executed. You can also use the Coverage Analyzer to find out which code is not used and could therefore be deleted, for example.
Prerequisites
-
The system being tested (target system) needs SAP NetWeaver Release 7.31 or higher.
-
The Coverage Analyzer must be activated in the system under test or on the relevant application server (see also Activating and Deactivating the Coverage Analyzer). If the button is switched on, the kernel collects data about executed ABAP objects. This data is used for the analysis.
Procedure
To measure the test coverage from eCATT, proceed as follows:
-
Select the test object (test script or test configuration) for which you want to measure the test coverage, and choose Execute.
The start options are displayed.
-
On the General tab, make sure that the system data container in which the system or systems to be tested are maintained is entered under System Data. If no system data container or no target system is specified, the measurement is performed on the local system (<LOCAL>).
-
Select the Coverage Measurement tab.
Coverage measurement is deactivated by default.
-
To activate coverage measurement, select the relevant option in the Mode of Coverage Measurement field. You can perform the measurement for the complete test execution, for each test configuration, or for each variant.
-
In the Error Behavior field, specify how the system is to react to errors during coverage measurement. You can ignore these errors or specify that errors result in termination. You must also select the relevant option on the General tab under Error Behavior.
-
In the Target Systems subwindow, select the system or systems in which the test coverage is to be measured.
The standard target system is already activated. If you want to select another system or systems, select them in the list and choose the icon to refresh the display. You can refresh some systems directly by using the status icon. Next the column Cov. Analyzer Active appears and shows you if the Coverage Analyzer is active (green) or inactive (red) on the relevant systems. A yellow status indicates that there are RFC problems with the connection to the target system. The quick info for the status icon contains a detailed error message. If the Coverage Analyzer is activated in the relevant system or systems, you can activate coverage measurement for these systems by selecting the relevant checkbox in the Perform Measurement column.
-
In the Object Filter subwindow, you can restrict coverage measurement to programs, packages, or application components.
-
If required, change the retention period in the field of the same name. The default setting is to automatically delete the results of the coverage measurement after one day, to keep the volume of data as low as possible.
-
Choose Execute.
Result
After execution, the log contains information about coverage measurement, as well as links to the results of the test coverage measurement. The Start Options node contains information on the start conditions (measurement type, error behavior, and retention period) under which the test coverage measurement was performed. There are two ways in the log to navigate to the results of the coverage measurement in the target system:
-
The Result of Coverage Measurement node contains an overview of the test coverages. If, for example, you have selected that a coverage measurement is to be performed for each variant, you will find an entry for each variant here. Each measurement has an icon telling you whether the measurement was successful (green) or not (red). The variant name, the target system, and the destination are also displayed. Clicking the result ID takes you to the result of the test coverage.
-
The eCATT log entry for an executed test object also contains a link to the results of the coverage measurement, if it was started for this object. Expand the relevant node. The monitor icon tells you the command for which the test coverage measurement was performed. The COVERAGE_RESULT entry, which is displayed as the last entry before the end of a variant or the test run, has a link to the results of the coverage measurement.
The result of the coverage measurement displays an overview with the total number of statements, the number of statements run and not run, and the run statements as a percentage of the total. You can use the On/Off switch to specify which parts of the program are to be included when determining the percentage. In the results of the test coverage measurement, you can double-click to go from the overview to the individual statements.
Searching for Logs with Test Coverage Information
If you want to display a list of logs that contain test coverage information, call transaction SECATT and choose the logs icon. The log selection is displayed. In the Command Name field, enter COVERAGE_RESULT and choose Execute. A list of logs containing test coverage information is displayed.
Deleting Coverage Results from Logs
You can delete coverage results from logs. You may want to do this if the result ID is obsolete or you want to delete old data. To do this, select the logs from which you want to delete the coverage results in the log selection, and choose in the menu bar. The logs now only contain the information that a coverage measurement was performed; the link to the results is deleted.

