Show TOC

Procedure documentationStep 5: Saving Measurements and Results in a Measurement Series Locate this document in the navigation structure

Procedure

Save results and measurements so that you can use them for tracking and trend analysis in code coverage. You must explicitly save these objects to persist them as part of a measurement series. They are not automatically saved.

The API ensures that no inconsistencies can occur when you save. In practice, this means that you need only save result objects in order to also save an associated measurement and measurement series.

The code required to save these objects is shown below. Use it after running a measurement and generating results from it:

Syntax Syntax

  1. * Save your results in order to store them, the associated 
    * measurements, and the series for future reference
    DATA: repository TYPE REF TO if_scv_repository,
          result TYPE REF TO if_scv_result,
          measurement TYPE REF TO if_scv_measurement.
    
    repository->save_result( result ).
    
    * You can also save a measurement or series separately, 
    * if necessary. Saving a measurement does not save any 
    * associated results.  
    repository->save_measurement( measurement ).
    
End of the code.

For ease in reloading series, measurements, and results, be sure to name them.

Here is what each object offers in persisted data:

  • Measurement Series: Management information, such as the last save of the series and the user who did the save.

  • Measurement: The state of the measurement (initial, started, stopped), the users whose activity is being recorded, start and stop timestamps, and other metainformation on the measurement.

    Save a measurement in state STARTED if you want it to run to record asynchronous activity — across user contexts, over a period of time.

  • Results: The actual code coverage statistics for the entities that you selected, calculated according to the active configuration.

Continue to Step 6: Finding Measurements and Results in a Measurement Series.

Click here to see the complete sample code.