Code Coverage Preferences
The behavior of the EclEmma plug-in can be adjusted in the Eclipse
Preferences dialog. Open the dialog from the
Window → Preferences menu. EclEmma's settings are located
on the page Java → Code Coverage. Or simply type
coverage in the filter field. The Code Coverage preferences page
contains the following options.
- Open coverage view automatically:
Whenever a new coverage session becomes active the
Coverage view can be automatically shown
in the current workbench window. (Default: on)
- Activate new coverage sessions:
A new session is created when a coverage launch
terminates or a session is imported. This
option determines whether the new session should become automatically active,
i.e. its result data is shown in the coverage view and in the Java editors.
(Default: on)
- Remove coverage sessions for removed launches:
Coverage session will be available until they are manually deleted in the
Coverage view. For frequent test runs
it might be more convenient to remove them automatically with the associated
launches. (Default: off)
- Reset execution data on dump:
For a running application coverage data can be dumped at any time from
Coverage view. This option determines
whether execution data is reset after such an intermediate dump.
(Default: off)
When a launch configuration is executed in code coverage mode the first time
EclEmma selects class path entries that will be in scope for code coverage
analysis by default. There are several options to modify the default selection
behavior:
- Source folders only:
Consider source based class path entries only. (Default: on)
- Same project only:
Pick only class path entries from the same project. This option works only for
launch configurations that have a project associated, i.e. Java applications.
(Default: off)
- Only path entries matching:
Comma separated list of strings that must match with the class path entry.
A class path entry matches the filter, if it contains one of the given
strings. (e.g. "src/main/java", Default: no filter)
Warning: If your settings do not match any of the class path entries in
your project(s), every new launch in coverage mode will have an empty analysis
scope.
For technical reasons it might be necessary to exclude certain classes from
code coverage analysis. The following options configure the coverage agent to
exclude certain classes from analysis. Except for performance optimization or
technical corner cases these options are normally not required.
- Includes:
A list of class names that should be included in execution analysis. The
list entries are separated by a colon (:) and may use wildcard characters
(* and ?). (Default: *)
- Excludes:
A list of class names that should be excluded from execution analysis. The
list entries are separated by a colon (:) and may use wildcard characters
(* and ?). (Default: empty)
- Exclude classloaders:
A list of class loader names that should be excluded from execution
analysis. The list entries are separated by a colon (:) and may use wildcard
characters (* and ?). This option might be required in case of special
frameworks that conflict with JaCoCo code instrumentation, in particular
class loaders that do not have access to the Java runtime classes.
(Default: sun.reflect.DelegatingClassLoader)
Warning: Use these options with caution! Invalid entries might break
the code coverage launcher. Also do not use these options to define the scope
of your analysis. Excluded classes will still show as not covered.
Other Relevant Preference Pages
Java elements in the various Eclipse views like the Package Explorer
might be directly decorated with coverage data
from the current session. This can be enabled on the page General →
Appearance → Label Decorators. The corresponding entry is
- Java Code Coverage (Default: off)
The annotation style for code coverage in
editors can be adjusted on the page General → Editors →
Text Editors → Annotations. The corresponding entries are:
- Full Coverage (Default: green highlighting)
- Partial Coverage (Default: yellow highlighting)
- No Coverage (Default: red highlighting)