Eclipse allows running Java programs directly from the workbench. Programs can be launched in different so called launch modes. In a standard Eclipse installation you can select launch your programs either in Run or in Debug mode. EclEmma adds a new launch mode Coverage, which is available from the Run menu and the toolbar:
Note: If the Coverage drop-down toolbar button is not visible in your current workbench perspective, open the Customize Perspective... dialog and enable the Coverage command group on the Commands tab.
Existing launch configurations can be launched directly with in Coverage mode using default settings. Optionally these settings can be modified in the coverage launch dialog:
In the Coverage tab the Java classes that should be prepared for coverage analysis can be selected. EMMA modifies these classes in a process called instrumentation. Instrumentation is possible for source based classes as well as for binary libraries.
EclEmma tries not to touch your project's content. Therefore class files are normally instrumented outside your project in a temporary folder. Optionally class files can be instrumented in-place by selecting the corresponding check box on the Coverage tab.
Outside Instrumentation | In-place Instrumentation | |
Instrumentation | Instrumented classes will be saved in a temporary folder outside your project. | The compiled classes will be instrumented directly in your project. |
Java Classpath | The classpath will be modified to include the locations of the instrumented classes. | The classpath will not be modified. |
Binary Libraries | Binary libraries can also be analysed for coverage. | Binary libraries can not be analysed, as this would permanently modify them. |
Supported Launch Types | Local Java application, JUnit test | Local Java application, JUnit test, JUnit plug-in test |
Programs that do not accept a Java classpath, i.e. using their own class loading mechanisms, require in-place instrumentation.
Warning: Instrumentation will modify your class files. Instrumented class files can not be used with launch modes other than Coverage. Therefore a clean build is required after a coverage launch with in-place instrumentation.