Code Coverage Preferences
The behaviour 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)
- Show in-place instrumentation warning:
Launching a coverage test with so called in-place instrumentation will
modify your original class files and requires a clean build before the next
normal launch. Therefore a optional warning dialog can be shown. (Default: on)
When a launch configuration is executed in code coverage mode the first time
EclEmma selects class path entries that will be instrumented 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 fail with error message
"No classes are selected for instrumentation".
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)