Monitoring code coverage to detect untested lines and methods
You can determine which parts of your code were not exercised during a profiling run by collecting line and method level code coverage data. Data from multiple runs, multiple applications, and multiple hosts is not only preserved in separate files, but is also merged into composite coverage data sets.
To collect data, use the Profiling and Logging perspective. Specify the Method and Line Code Coverage profiling type in your profiling set to collect both line and method coverage data.
The following views are available to display line and method coverage data:
- The Coverage Details views:
- The Coverage Navigator view, which uses bar graphs to indicate coverage levels for packages, classes, and methods.
- The Annotated Source view, which includes the following displays:
- Source code with annotation: For classes and methods for which source code is available, a copy of your code that is marked to show tested, untested, and partially tested lines.
- Source data: At the class and method level, pie charts showing line-level coverage statistic, as well as tables showing the coverage for each line. At the package level and above, coverage summaries.
- The Coverage Statistics view, which shows statistical data in tabular format.
Data from multiple runs is merged automatically into a cumulative coverage data set at the level of host and above.
Note: A Method Code Coverage profiling type is also available, but it does not collect data that can be displayed in the Coverage Navigator or the Annotated Source views.
The following topics provide specific instructions:
Collecting coverage data for lines and methods
Begin coverage analysis by collecting data for a profiling run.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.
Parent topic
Detecting and analyzing run-time problems
Related concepts
Code coverage monitoring user interface reference
Related tasks
Getting started: Creating a profiling configuration for run-time problem determination
Related information
Getting started: Profiling J2EE applications
Getting started: Code coverage monitoring