Configuring Java code coverage indicators

About this task

In the Java™ code coverage preferences page, you can configure the indicators themselves.

Procedure

  1. To open the Java code coverage preference page, click Window > Preferences > Java > Java Code Coverage.
  2. In the Code Coverage Indicators box, select one or more indicators for coverage of packages, source files, types (a concrete class or enumeration), and methods.
    If you choose more than one, the hierarchy is type, method, block, and line, in the order shown in the box. Please note that the definition of a block is code (portion of a line, a single line, or multiple lines) that cannot be branched into or branched out of. All of the code in a block is executed as a single group of instructions. Blocks are terminated with a branch in or branch out (for example calling a method, throwing an exception, or returning).
    Note: Clearing the Show colored indicators in the views check box will remove the colored decorations from the Package Explorer and views (such as the Outline view) while preserving the display of code coverage percentages (without color).
  3. Click Aplly > OK.

Example

In the following example, only block indicators are selected:
Code Coverage Indicators
Therefore, the Package Explorer and views show only block code coverage:
Block Decorations
Instead, if both block and method coverage indicators are selected, the Package Explorer shows method coverage before block coverage:
Block and Method Indicators