Running code coverage

Running code coverage provides insight into how well your test cases are exercising your compiled language applications by reporting results showing the percentage of lines in your code that have been run by a test case as well as line by line coverage details.

About this task

You can run code coverage for any compiled language application that you can debug.

Procedure

  1. Compile your program with debug information.
    Note: If portions of the application do not have debug information, only those portions of the application with debug information will be included in the code coverage report.
  2. Run code coverage for your compiled language program either from the Toolbar, the Debug perspective or the Remote Systems Explorer perspective:
    • From the Toolbar or the Debug perspective:
    1. Using the Code Coverage pulldown on the toolbar Code Coverage pulldown, select Code Coverage Configurations....
      Tip: Alternatively, from the Debug perspective, select Run > Compiled Code Coverage Configurations....
    2. In the Program tab of the Compiled Code Coverage Configurations dialog, choose the RSE connection and specify the program that you want to run code coverage against.
    3. Optional: By default, code coverage results are collected independently for each run. However, you may want to collect code coverage data on the same program under different parameters or using different scenarios. For example, using different parameters may affect the execution of lines within an if or else block. In these cases, you have the option of collecting code coverage results cumulatively as this will improve code coverage performance. To choose this option:
      • Select the Code Coverage tab.
      • Select either Append to the previous result (which will use the last launch's results as the baseline for the current launch) or Append to a specific result (which will use the code coverage results from the launch file you specify as the baseline for the current launch).
      • Specify the Code Coverage Level.
      • Click Apply.
    4. Click the Coverage button.
    • From the Remote Systems Explorer perspective:
    1. Select the compiled program.
    2. Right click and select Compiled Code Coverage > Compiled Application.

What to do next

Code coverage data collection is launched in the Debug perspective but the code coverage report automatically opens in the perspective that is current once the data collection completes. Now you can view your code coverage results.

Feedback