Show TOC

Step 4: Calculating Coverage Results in a Measurement SeriesLocate this document in the navigation structure

Procedure

The default configuration and object set saved with a measurement series make it easy to calculate code coverages. The series defaults are passed automatically to each measurement. That means that you can simply use the BUILD_SELECTION_RESULT method to get the default results.

Here is sample code for generating the series-default code coverage statistics.

DATA: measurement TYPE REF TO if_scv_measurement, 
      result TYPE REF TO if_scv_result.

* The measurement must be stopped before 
* you can calculate results. Here, you 
* calculate the default results saved with 
* the series.
result = measurement->build_selection_result( ).
result->set_name( "STANDARD_RESULT" ). 
         " Series default selection is used

* Request an additional result and 
* name it for later retrieval.
DATA package_result TYPE REF TO if_scv_result.
package_result = measurement->build_package_result( 'SMOI' ).
package_result->set_name( "PACKAGE_SMOI" ).

         

The sample code first uses the BUILD_SELECTION_RESULT method, which automatically uses the default configuration and object selection saved with the series. Then BUILD_PACKAGE_RESULT generates a second result. This measurement uses the default configuration as well. Both are named for ease in retrieval.

You can calculate as many different additional results as you wish. You can either use the named-entity methods, like BUILD_PACKAGE_RESULT. Or define additional configuration and/or selection objects and specify them when you calculate the additional results. The default configuration and selection remain unchanged.

Note

If you wish to work with multiple sets of results, see Naming Measurements and Results.

Continue to Step 5: Saving Measurements and Results in a Measurement Series.

Here is the complete tutorial program.