Using the Code Coverage Viewer to view reports

Code Coverage for Ada, C and C++

The Code Coverage Viewer allows you to view code coverage reports generated by the Code Coverage feature. Select a tab at the top of the Code Coverage Viewer window to select the type of report:

  • A Source report that displays the source code under analysis, highlighted with the actual coverage information.

  • A rates report that provides detailed coverage rates for each activated coverage type.

You can use the Report Explorer to navigate through the report. Click a source code component in the Report Explorer to go to the corresponding line in the Report Viewer.

You can jump directly to the next or previous Failed test in the report by using the Next Failed Test or Previous Failed Test buttons from the Code Coverage toolbar.

You can jump directly to the next or previous Uncovered line in the Source report by using the Next Uncovered Line or Previous Uncovered Line buttons in the Code Coverage feature bar.

When viewing a Source coverage report, the Code Coverage Viewer provides several additional viewing features for refined code coverage analysis.

To open a Code Coverage report:

  1. Right-click a previously executed test or application node.
  2. If a Code Coverage report was generated during execution of the node, select View Report and then Code Coverage.

Coverage types

Depending on the language selected, the Code Coverage feature offers the following choices:

  • Function or Method code coverage: select between function Entries, Entries and exits, or None.

  • Call code coverage: select Yes or No to toggle call coverage for Ada and C.

  • Block code coverage: select the block coverage method you need.

  • Condition code coverage: select condition coverage for Ada and C.

Any of the Code Coverage types selected for instrumentation can be filtered out in the Code Coverage report stage if necessary.

To filter coverage types from the report, proceed as follows:
  1. From the Code Coverage menu, select Code Coverage Type.
  2. Toggle each coverage type in the menu.

    For example, to filter out multiple conditions (MC) from the report, select Code Coverage > > Code Coverage Type, and clear Multiple conditions.

  3. Alternatively, you can filter out coverage types from the Code Coverage toolbar by toggling the Code Coverage type filter buttons.

Test by test analysis mode

The test by test analysis mode allows you to refine the coverage analysis by individually selecting the various tests that were generated during executions of the test or application node. In Test-by-Test mode, a Tests node is available in the Report Explorer.

When test by test analysis is disabled, the Code Coverage Viewer displays all traces as one global test.

To toggle test by test mode, proceed as follows:
  1. In the Code Coverage Viewer window, select the Source tab.
  2. From the Code Coverage menu, select Test-by-Test.

To select the Tests to display in Test-by-Test mode, follow these steps:

  1. Expand the Tests node at the top of the Report Explorer.
  2. Select one or several tests. The Coverage Viewer provides code coverage information for the selected tests.

Opening the HTML report

You can open the code coverage report in an HTML format if it is available.

To open the HTML report, select Open HTML report in the Coverage Viewer menu.

The HTML coverage report has been generated in the build folder with the extension .cov.html. The root name of the report is the name of the application, or the name of the test harness, or the name of the test suite result.
Note: The HTML report is created from a template file: covreport.template located in the folder <installation folder>/lib/report. You can modify this template. This is the default template that can be used as a string point for a new template.
To select a new template file, select Code coverage > Advanced options in the build settings. Then, click Coverage Report Template to select the new template file.