Ok, here we go,
Remember my problem when enabling the plugin (and
losing the instrumented classes)?
That problem remains...
So I did a few modifications at the plugin code,
adding/changing actions.
Requirements:
- emma-2.1.5320
ResetDataAction:
- Remove coverage.ec
- Remove internal xml and html report
- Instrument the classes (not using
BuildRunner.startBuild())
CleanExistingCoverageData (new):
- Run ctl coverage.reset
BuildReportAction
- Automatically dump the coverage data by ctl
J2EE test:
Configuration to Work:
- Project with emma-2.1.5320 in the classpath
- Project with emma.properties in the classpath (this
file can't be in Jboss deploy folder.
It will be just in classpath project).
emma.properties must contain the "rt.control = false"
property.
- The project classes must be in an exploded jar into
deploy folder.
Classpath example:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="implementacao/src/java"/>
<classpathentry output="target/exp-eclipse-only"
kind="src" path="target/exp-eclipse-only"/> <!-- This
is where emma.properties will be -->
<classpathentry kind="var"
path="MAVEN_REPO/emma/jars/emma-2.1.5320.jar"/>
<classpathentry kind="output"
path="systemparameters-geral-cactus.ear/systemparameters-geral-ejb-2.0.0.jar"/>
</classpath>
Steps to test:
- Enable Emma Plugin
- Use ResetDataAction
- Run JBOSS
- Run Tests
- BuildReportAction
- ShowCoverage
- CleanExistingCoverageData
- BuildReportAction
- Show Coverage
The test worked fine, and I got the expected coverage.
So I just needed to use ResetDataAction,
BuildReportAction, CleanExistingCoverageData and
ShowReportAction
to do anything that I want with the plugin.
- Summarizing -
So what is the ideia?
Make a simple plugin!
What we need to do to make the plugin works in
different enviroment?
Turn it very configurable.
Interesting Options to add in Emma's Project property
(checkbox):
- Add jar to the classpath
- Get the coverage by dump
Interesting feature to add to the Plugin:
- Use ctl (to dump, reset...)
Interesting Modifications:
- A better way to instrument the code
----------------------------------------------
--Saraiva
Modifications that I did