
plugins.eclipse.emma-plugin-eclipse.doc.getting-started.html Maven / Gradle / Ivy
Show all versions of emma_ant Show documentation
Emma Eclipse plugin user guide
Getting started
To enable Emma for a java project, right click the project and select Properties for
that project:
[javaProject]> Properties.
Selecting properties for a project
On the properties page, select The option Emma. A page with a checkbox and some
text fields appears. Add a check in the checkbox and press Ok.
Enable Emma monitoring for project.
Once Emma is enabled for the project, two noticeable things happens. First, a folder
named .emma appears at the root of the project. Secondly, the Emma jar gets
added to the classpath of the project. Under the hood, all classes that exists for the
project gets Emma monitoring code added to them. The emma jar needs to be added to the classpath
of the project since once the class files get the extra monitoring code added, every
time they are executed they need to have the required Emma classes on the classpath.
All this is done automatically when the plugin is enabled. When it is disabled, the
classpath is cleaned. You may or may not see the folder and the added classpath in the
Package Explorer, depending on how your view filters are set.
Once Emma is enabled for a project, a small indicator symbol appears in the top
left corner of the project, so that you can see which projects are monitored with
a quick glance.
The added folder and classpath
When Emma is enabled it constantly tracks the work environment for changes in
the compiled sources so that it's always up to date. When any class is executed,
Emma monitors the execution and saves the execution data.
Try running a class in a project where Emma is enabled. The coverage state should
appear as decorations on each source file in the project.
Running a class
The decorated classes
Once you have created a coverage for a class you can view the exact report for
that class by right clicking on the source file and selecting the Show coverage report
from the Emma menu.
Showing the report
Example report displayed inline
That's it! That's all you need to know to add code coverage as a tool to your
toolset. Once you get started using it, it's a habit that's very difficult to
live without.