Hey Guys,
Here is the Emma Report
(http://csdl.ics.hawaii.edu/~kagawaa/emma/emma/coverage.html) for the
following modules:
hackyCore_Kernel.available=true
hackyCore_Installer.available=true
hackyCore_Common.available=true
hackyCore_Report.available=true
hackyCore_Statistics.available=true
hackyCore_Telemetry.available=true
hackySdt_Activity.available=true
It was pretty easy to setup emma within the new build system for client
side tests. However, the server side tests were a bit harder. It seems
pretty fast too. It took only too 4 minutes for ant -q hackyCore_Build.emma
(freshStart, all.junit, and do all the coverage stuff). Compared to 3
minutes and 18 seconds for the regular build, ant -q freshStart
all.junit. I think I tried Jblanket a while ago in V6 build infrastructure
and that took close to 45 minutes.
Here is the initial version of the emma.build.xml
(http://csdl.ics.hawaii.edu/~kagawaa/emma/emma.build.xml). There are a
couple of key things to note:
1) I had to manually duplicate the freshStart target with a bunch of
<antcall> targets. I had to do this because I had to instrument the class
files before hotDeployHackystat.
2) Emma requires a shutdown of tomcat to collect server side coverage
information. There is a new Emma feature to retrive this information at
runtime. But, it seems that this might be the better solution.
3) The Emma report can be linked to the source code, which provides colored
highlighting of covered methods, blocks, and lines. To use this feature, I
had to "hard code" the source directories. For example:
<sourcepath>
<dirset dir="${hackyCore_Kernel.src.dir}" />
<dirset dir="${hackyCore_Installer.src.dir}" />
<dirset dir="${hackyCore_Common.src.dir}" />
<dirset dir="${hackyCore_Report.src.dir}" />
<dirset dir="${hackyCore_Statistics.src.dir}" />
<dirset dir="${hackyCore_Telemetry.src.dir}" />
<dirset dir="${hackySdt_Activity.src.dir}" />
</sourcepath>
We can take that out, but would lose the source code linking. Maybe there
is a way to make this more dynamic?
4) I had to re-write a custom makeJUnit macrodef to include some
systemproperties and an altered classpath. I tried, with no success, to do
something like
<!--
<makeJUnit
module.name="hackyCore_Kernel"
module.src.dir="${hackyCore_Kernel.src.dir}"
junit.fork="on">
<classpath.elements>
<- instrumented classes must be first in the classpath: ->
<pathelement location="${emma.outinstr.report.dir}" />
<path refid="instrument.emma.classpath" />
<- the forked JVM must have jact.jar in the classpath: ->
<path refid="emma.lib" />
<pathelement location="${install.war.web-inf.classes.dir}" />
<pathelement location="${java.class.path}" />
</classpath.elements>
<sysproperty.elements>
<sysproperty key="emma.coverage.out.file"
value="C:\java\svn\hackyCore_Build\build\coverage\coverage.emma" />
<sysproperty key="emma.coverage.out.merge" value="true" />
</sysproperty.elements>
</makeJUnit>
<makeEcho message="Completed hackyCore_Kernel.junit."
prefix="hackyCore_Kernel.junit"/>
-->
But, that doesn't work because for some reason the classpath.elements
doesn't preserve the order. I need the instrumented classes to be first on
the classpath. In addition, I would have to add targets to the
local.build.xml files. For example, hackyCore_Kernel.junit-emma.
Anyway, because of the overriding of makeJUnit macrodef I get all these
override echos
http://csdl.ics.hawaii.edu/~kagawaa/emma/CommandPrompt-ant-hackyCore_Build.emma.txt
5) According to Emma's FAQ
(http://emma.sourceforge.net/faq.html#q.runtime.appservers), I had to add
emma.jar to <jre dire>/lib/ext. The FAQ says that it might be possible
to add the jar file to tomcat's classpath. I'll look into this more.
6) I'm using the latest beta distribution of Emma, because it has some new
features. But, I'm not sure if I using them or not. I will investigate if
I can revert back to the stable release.
To conclude, it seems that Emma might be a good fit for Hackystat.
Some questions:
- Philip: can I go ahead and import the emma.build.xml into SVN?
- Any suggestions on how to make the emma.build.xml better?
- Does Jblanket work in the V7 build? I want to compare JBlanket's
information to Emma's. Actually, it would be great if someone in CSDL can
help me out with this task.
thanks, aaron