Follow the procedure below to collect code coverage.

  1. Instrument and build your code with the cpptestcc coverage tool; see Integrating Code Coverage with Project Build.
    This step produces .map files required for coverage data files generation.
  2. Execute the instrumented application. See Executing Instrumented Application.
    This step produces a .clog file required for coverage data files generation.
  3. Generate coverage data files using cpptestcov compute:  
    cpptestcov compute -map=.cpptest/cpptestcc -clog=cpptest_results.clog -out=cov-data-run1

    This step produces coverage data files used for generating reports.

  4. Report coverage statistics using cpptestcov report text.
    cpptestcov report text cov-data-run1

The basic workflow can be further extended with the following steps:

  • Generate an HTML report using cpptestcov report html.
  • Report lines notcovered using cpptestcov report uncovered-lines.
  • Merge multiple coverage data folders using cpptestcov merge.
  • Publish coverage statistics to Parasoft DTP using cpptestcov report dtp.
  • Report line coverage in lcov format using cpptestcov report lcov.
  • Report line coverage in Cobertura format using cpptestcov report cobertura.

See Tools and Commands Reference for details on these commands.

  • No labels