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 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
- Compile your program with debug information.
Note: If
portions of the application do not have debug information, they are
included in the report with this detail specified, but not included
in any calculations (for example thresholds). Module level coverage
always includes modules without debug information as part of its calculations.
- 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:
- Using the Code Coverage pulldown on the toolbar
,
select Code Coverage Configurations.... Tip: Alternatively, from the Debug perspective, select .
- 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.
- Optional: Set code coverage
parameters. 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 results from the previous launch 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. By default,
code coverage is run at the line level. However for performance reasons,
you may want to run code coverage at the function, or module level.
Optional: When running module level code coverage, specify a module
file which contains the list of expected modules.
- Optional: Specify the Report Options. By default,
a workbench report is always produced. Select Generate HTML report to
have an HTML report produced after the code coverage run is complete.
Select Generate PDF report to have a PDF report produced after
the code coverage run is complete.
- Optional: Specify the Additional Options.
Select Ignore errors to force code coverage to produce a report,
regardless of error conditions. Specify desired Tags to be
associated with the code coverage run. For example, you may wish
to tag a code coverage result with a test case name or number.
- Click Apply.
- Click the Coverage button.
- From the Remote Systems Explorer perspective:
- Select the compiled program.
- Right-click and select .
Results
Code coverage data collection is launched in the
Debug perspective but the code coverage report automatically opens
in the perspective that is current after the data collection is complete.
Now you can view the code coverage results.