rajeshkumar created the topic: Ant Example code for Emma Instrumentation
In-place instrument a certain subset of already compiled classes using overwrite mode and several coverage filters:
[code language=”css”]
<emma enabled=”${emma.enabled}” >
<instr instrpathref=”${out.dir}/classes”
mode=”overwrite”
>
<!– always exclude every class with a “Test” in the name: –>
<filter excludes=”*Test*” />
<!– don’t instrument everything in “${out.dir}/classes”,
only the stuff I am working on now: –>
<filter file=”myincludes.txt” />
<!– additional ANT command line hook: –>
<filter value=”${emma.filter}” />
</instr>
</emma>
[/code]
Don’t overwrite compiled classes that later need to go into official release jars (stay in copy mode). However, use incremental instrumentation for fast personal testing:
[code language=”css”]
<emma enabled=”${emma.enabled}” >
<instr instrpathref=”${out.dir}/classes”
outdir=”${out.dir}/classes-instrumented”
merge=”yes”
filter=”${emma.filter}”
/>
</emma>
[/code]
Take all jars already produced by the product build and make test (coverage-enabled) copies of them:
[code language=”css”]
<emma enabled=”${emma.enabled}” >
<instr mode=”fullcopy”
outdir=”${out.instr.dir}”
merge=”no”
filter=”${emma.filter}”
>
<instrpath>
<fileset dir=”${out.dir}” includes=”**/*.jar” />
</instrpath>
</instr>
</emma>
[/code]
[code language=”css”]
<copy todir=”${dist}”>
<fileset dir=”${src}”
includes=”**/images/*”
excludes=”**/*.gif”
/>
</copy>
[/code]
[code language=”css”]
<copy todir=”${dist}”>
<fileset dir=”${src}”>
<include name=”**/images/*”/>
<exclude name=”**/*.gif”/>
</fileset>
</copy>
[/code]
[code language=”css”]
<fileset dir=”${server.src}” casesensitive=”yes”>
<include name=”**/*.java”/>
<exclude name=”**/*Test*”/>
</fileset>
[/code]
[code language=”css”]
<fileset dir=”${server.src}” casesensitive=”yes”>
<patternset id=”non.test.sources”>
<include name=”**/*.java”/>
<exclude name=”**/*Test*”/>
</patternset>
</fileset>
[/code]
Groups all files in directory ${client.src}, using the same patterns as the above example.
[code language=”css”]
<fileset dir=”${client.src}” >
<patternset refid=”non.test.sources”/>
</fileset>
[/code]
Groups the same files as the top example, but using the
[code language=”css”]
<fileset dir=”${server.src}” casesensitive=”yes”>
<filename name=”**/*.java”/>
<filename name=”**/*Test*” negate=”true”/>
</fileset>
[/code]
Groups the same files as the previous example using a combination of the
[code language=”css”]
<fileset dir=”${server.src}” casesensitive=”yes”>
<filename name=”**/*.java”/>
<not>
<filename name=”**/*Test*”/>
</not>
</fileset>
[/code]
Selects all files in src/main
[code language=”css”]
<fileset dir=”src” includes=”main/” />
<emma enabled=”${emma.enabled}” >
<instr mode=”overwrite”
instrpath=”${jar.location}”
destdir=”${inst.jar.location}”
metadatafile=”${inst.jar.location}/metadata.emma”
merge=”no” >
<instrpath>
<fileset dir=”${jar.location}” includes=”elance-services.jar,web-classes.jar,applet.jar,application-ejb.jar” />
</instrpath>
</instr>
</emma>
<emma enabled=”${emma.enabled}” >
<instr mode=”fullcopy”
instrpath=”${jar.location}”
outdir=”${inst.jar.location}”
metadatafile=”${inst.jar.location}/metadata.emma”
merge=”no” >
<instrpath>
<fileset dir=”${jar.location}” includes=”elance-services.jar,web-classes.jar,applet.jar,application-ejb.jar” />
</instrpath>
</instr>
</emma>
[/code]
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn
- Best AI tools for Software Engineers - November 4, 2024
- Installing Jupyter: Get up and running on your computer - November 2, 2024
- An Introduction of SymOps by SymOps.com - October 30, 2024