|EclEmma 2.3.2||Java Code Coverage for Eclipse|
Frequently Asked Questions
If you remove the coverage session, also the coverage coloring will disappear. For this, hit Remove Session or Remove All Sessions in the Coverage view's toolbar.
EclEmma is designed for Java programs launched within Eclipse. Java applications that run in a different environment may be directly analyzed with JaCoCo using for example the Ant or Maven integrations. There are different supported launch types, other plug-ins may define additional launch types which are not supported by EclEmma. Check user documentation for currently supported launch types.
The source code highlighting can be changed in the Eclipse Preference dialog at General → Appearance → Editors → Text Editors → Annotations. You can modify the highlighting style and color or use the vertical rulers instead.
No, you can also get coverage information for e.g. third-party JARs. Just make them part of your class path settings in Eclipse and select them on the Coverage tab in the coverage launch dialog. If the library was compiled with debug information, line coverage will be shown in the Coverage view. In case the source is properly attached to the library syntax highlighting will happen in the editors the same way as with you source code.
EclEmma annotates all lines which are partly covered in yellow. Partly covered means that not all instructions and branches associated with this line have been executed during the coverage session. In some cases it is not obvious why the Java compiler creates extra byte code for a particular line of source code. Such situations might be filtered by future versions of JaCoCo/EclEmma.
The analysis scope for coverage sessions can be defined in the Coverage launch dialog on source folder (or library) granularity. As test code is typically kept in separate source folders or projects this allows to exclude your test classes from coverage analysis.
This happens when the Java process did not terminate properly, e.g. has been manually killed with the Terminate button. Make sure your Java program terminates on its own. Alternatively you can dump coverage data for the running process before you terminate it. For this select the button Dump Execution Data from the Coverage view's toolbar.
The underlying JaCoCo code coverage library works with so called probes. Probes are inserted into the control flow at certain positions. Code is considered as executed when a subsequent probe has been executed. In case of exceptions such a sequence of instructions is aborted somewhere in the middle and not marked as executed.
Does your application properly execute within Eclipse in normal run mode? Please verify! If not, your app will most likely not execute in coverage mode either. In this case first create a proper launch configuration in Eclipse; then execute in coverage mode.
Even if EclEmma is installed properly, it will show its action sets only in some predefined perspectives related to Java tasks. If you want to use the coverage toolbar in other perspectives like Resource select Customize Perspective... from the toolbar's context menu and check the Java Code Coverage option on the Command Groups Availability tab.
JUnit4 test cases with expected exceptions are shown as not covered even
though they were executed. The reason for this is that underlying JaCoCo code
coverage library only considers code as executed when certain probes are
executed. For successful test cases marked with
In Eclipse preferences there is an option Launch in debug mode when workspace contains breakpoints under Run/Debug → Launching. If this option is enabled and there are breakpoints in your workspace coverage mode will not work, because it is automatically replaced with debug mode. Set this option to Never if you want to run code coverage analysis.
|Copyright © 2006, 2015 Mountainminds GmbH & Co. KG and Contributors||Validate XHTML/CSS · Last Modified 2013-03-12 in Commit ecdb1c1a|