在ant build.xml中使用Emma for JUnit
我是使用Emma的新手。我试图为EAR项目中的模块添加用于JUnit测试用例的emma ant任务。我这里没有什么问题在ant build.xml中使用Emma for JUnit,ant,junit4,emma,Ant,Junit4,Emma,我是使用Emma的新手。我试图为EAR项目中的模块添加用于JUnit测试用例的emma ant任务。我这里没有什么问题 我应该使用instrumented类包装我的EAR projet吗 为junit添加emma ant任务的好方法是什么?我应该使用emmarun:动态模式还是脱机模式?对于JUnit,我应该使用fork还是不使用fork 我正在使用Emma脱机模式和Junit with fork。这是我的build.xml <!--Target and task for EMMA -
- 我应该使用instrumented类包装我的EAR projet吗
- 为junit添加emma ant任务的好方法是什么?我应该使用emmarun:动态模式还是脱机模式?对于JUnit,我应该使用fork还是不使用fork李>
<!--Target and task for EMMA -->
<taskdef resource="emma_ant.properties" classpathref="Emma.libraryclasspath" />
<target name="emma" description="turns on EMMA's instrumentation/reporting" >
<property name="emma.enabled" value="true" />
<mkdir dir="${out.instr.dir}" />
<property name="emma.filter" value="" />
</target>
<target name="test" depends="init, compile" description="Run JUnit Test cases under emma environment">
<!-- Emma instrumentation -->
<emma enabled="${emma.enabled}" verbosity="verbose">
<instr instrpath="${class.dir}"
destdir="${out.instr.dir}"
metadatafile="${coverage.dir}/metadata.em"
merge="true"
mode="copy">
<filter value="${emma.filter}" />
</instr>
</emma>
<!-- JUnit Start -->
<junit printsummary="yes" fork="yes">
<test name="com.hf.platform.authorizer.WebTxnAuthorizerTest" todir="${test.report.dir}">
<formatter type="xml"/>
</test>
<classpath>
<path refid="HFPlatformWeb.classpath"/>
<path refid="Emma.libraryclasspath"/>
</classpath>
<jvmarg value="-Demma.coverage.out.file=${coverage.dir}/coverage.ec" />
<jvmarg value="-Demma.coverage.out.merge=false" />
</junit>
<!-- Junit End -->
<emma enabled="${emma.enabled}" verbosity="verbose">
<report>
<sourcepath>
<dirset dir="${basedir}">
<include name="src"/>
<include name="test-src"/>
</dirset>
</sourcepath>
<fileset dir="${coverage.dir}">
<include name="*.em"/>
<include name="*.ec"/>
</fileset>
<xml outfile="${coverage.report.dir}/report.xml" />
<txt outfile="${coverage.report.dir}/report.txt" />
<html outfile="${coverage.report.dir}/report.html" />
</report>
</emma>
</target>
当我运行它进行一次测试时,它没有生成任何报告。但当我使用EclEmma运行相同的单元测试时,它给出了正确的输出。在上面的示例中,我们需要确保以下两件事