Viewing and analyzing coverage data for lines and methods

View and analyze line and method coverage data in the Coverage Statistics, Coverage Navigator, and Annotated Source views.

Prerequisite: Collecting coverage data for lines and methods

  1. Display the three coverage views for your profiling resource. If you have performed multiple profiling runs, select a profiling resource at the level of Host or higher to see the automatically merged data. If necessary, use the Profiling Monitor toolbar drop-down menu to display resources at the correct level.

    1. Right-click the profiling resource, then in the pop-up menu select Open With > Coverage Details. This opens both the Annotated Source and Coverage Navigator views. If these views report No data available for display, read Flushing coverage data for display in the Coverage Details views.

    2. Right-click the profiling resource, then in the pop-up menu select Open With > Coverage Statistics.

  2. Check coverage at the method level by using the Methods columns in the Coverage Statistics view.

  3. Check coverage at the line level by using the Units columns in the Coverage Statistics view and the two-colored bar graphs (

    ) to the left of each entry in the Coverage Navigator view. Units are executable byte-code commands; a line of code can contain one or more units.

  4. Identify the specific lines or units that you have not exercised in the Annotated Source view by clicking an item in the Coverage Statistics or Coverage Navigator view to display it in the Annotated Source view. If the Link with Viewer button

    Link with Viewer button in the Profiling Monitor is selected, clicking any item in the Coverage Navigator or the Coverage Statistics view synchronizes all three views.

  5. In the Annotated Source view, click the Show Source Code with Annotations button

    Annotated Source toggle button to toggle between the Source Data and Source Code with Annotations displays.

    1. Use the line tables in the Source Data display to identify uncovered lines.

    2. Use the Source Code with Annotations display to see coverage annotations displayed directly on a copy of your code.

The following tasks provide additional information about viewing and analyzing coverage data:

Managing data in the Coverage Statistics view
The Coverage Statistics view allows you to filter and rearrange the data to suit your requirements.

Controlling the Coverage Navigator display
The Coverage Navigator view allows you to control how data is arranged and displayed.

Switching between source data and source code in the Annotated Source view
You can switch between the source data display and the source code display in the Annotated Source view. Source data is coverage pie charts and tables, and source code is a copy of your code marked with coverage annotation.

Changing fonts, colors, and font attributes in the Annotated Source view
You can customize the display in the Annotated Source window using the Preferences pages.

Opening source code for editing
You can open your source code, if available, for editing from within the Coverage Statistics and Coverage Navigator views. Source code is available for editing only if you are profiling a Java project that is currently open in the Java perspective.

 

Parent topic

Monitoring code coverage to detect untested lines and methods

 

Related tasks

Collecting coverage data for lines and methods

Related reference
The Coverage Statistics view for line and method coverage data
The Coverage Navigator view
The Annotated Source view, source code with annotations display
The Annotated Source view, source data display