Hi
I've created Ant file where I start junit tests for instrumented classes.
I do not why but this Ant file works only from command line under Eclipse 2.1.3
file coverage.ec is created only once. When I delete this file it is not created again
during execution of Ant target (but when I close and repopen Eclipse and start my ant
file *.ec file is created once again?!?).
When I start Ant file from command line *.ec file is created without any problem.
Second problem is that coverage.ec file is created in strange directories! On one computer
it is created in Eclipse directory on antoher computer in project directory.
I've found that there is special property "coverage.out.file" but setting this property
in ant ( <property name="coverage.out.file" value="c:\tmp\test.ec"/>) does not help!
Any suggestions ?
The part of Ant file responsible for instrumentation and JUnit test is presented below.
Michal Szymanski (michal_szymanski@hotmail.com)
<emma enabled="true" >
<instr instrpathref="finca.dev.classpath.instr"
outdir="${build.instrumented}"
mode="fullcopy"
outfile="${build.instrumented}/rep_output.em">
</instr>
</emma>
<junit printsummary="yes" >
<test name="net.lidotech.finca.inttest.withoutrmi.IntegrationWithoutRmiSuite"/>
<test name="net.lidotech.finca.parser.test.VerifierTest"/>
</junit>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
(1) I am not entirely sure, but I think the problem with using EMMA in Ant is that at the moment the runtime coverage (*.ec) file is dumped only from a JVM shutdown hook thread (and that happens only once per each JVM's lifetime).
We would like to support a proper Eclipse plugin for EMMA one day. As a workaround in the meantime, make sure that Eclipse always forks Ant when using EMMA.
I simply don't know what you mean (i.e. are you setting a global Ant property or are you nesting this <property> element inside <emma>/<instr>?).
All EMMA properties and how to set them correctly are described in Chapter 3 of EMMA reference manual (http://emma.sourceforge.net/reference/ch03.html).
Based on your Ant build.xml snippet, I am guessing you need to set the location of *.ec file when running JUnit testcases. The default location for *.ec file is whatever user.dir is set to for your JVM. The easiest way to change this default for <junit> would be to
(a) fork junit
(b) set the desired location via a JVM system property:
Hi
I've created Ant file where I start junit tests for instrumented classes.
I do not why but this Ant file works only from command line under Eclipse 2.1.3
file coverage.ec is created only once. When I delete this file it is not created again
during execution of Ant target (but when I close and repopen Eclipse and start my ant
file *.ec file is created once again?!?).
When I start Ant file from command line *.ec file is created without any problem.
Second problem is that coverage.ec file is created in strange directories! On one computer
it is created in Eclipse directory on antoher computer in project directory.
I've found that there is special property "coverage.out.file" but setting this property
in ant ( <property name="coverage.out.file" value="c:\tmp\test.ec"/>) does not help!
Any suggestions ?
The part of Ant file responsible for instrumentation and JUnit test is presented below.
Michal Szymanski (michal_szymanski@hotmail.com)
<emma enabled="true" >
<instr instrpathref="finca.dev.classpath.instr"
outdir="${build.instrumented}"
mode="fullcopy"
outfile="${build.instrumented}/rep_output.em">
</instr>
</emma>
<junit printsummary="yes" >
<test name="net.lidotech.finca.inttest.withoutrmi.IntegrationWithoutRmiSuite"/>
<test name="net.lidotech.finca.parser.test.VerifierTest"/>
</junit>
(1) I am not entirely sure, but I think the problem with using EMMA in Ant is that at the moment the runtime coverage (*.ec) file is dumped only from a JVM shutdown hook thread (and that happens only once per each JVM's lifetime).
We would like to support a proper Eclipse plugin for EMMA one day. As a workaround in the meantime, make sure that Eclipse always forks Ant when using EMMA.
(2) When you mention
<property name="coverage.out.file" value="c:\tmp\test.ec"/>
I simply don't know what you mean (i.e. are you setting a global Ant property or are you nesting this <property> element inside <emma>/<instr>?).
All EMMA properties and how to set them correctly are described in Chapter 3 of EMMA reference manual (http://emma.sourceforge.net/reference/ch03.html).
Based on your Ant build.xml snippet, I am guessing you need to set the location of *.ec file when running JUnit testcases. The default location for *.ec file is whatever user.dir is set to for your JVM. The easiest way to change this default for <junit> would be to
(a) fork junit
(b) set the desired location via a JVM system property:
<junit fork="yes" ...
...
<jvmarg value="-Demma.coverage.out.file=c:/tmp/test.ec"/>
</junit>
using <sysproperty> might work as well, but start with <jvmarg> first.