当前位置: 代码迷 >> 综合 >> JUnit+Ant什么时候可以生成HTML形式的report
  详细解决方案

JUnit+Ant什么时候可以生成HTML形式的report

热度:71   发布时间:2023-12-16 07:26:52.0

这个问题实际上很简单,但是之前也让我迷惑了一下。如果像我之前这篇日志里写的,如果在后面加上junitreport:

<junitreport><fileset dir="build/testoutput" includes="*.xml"/><report todir="build/testoutput"/>
</junitreport>

则只是生成xml格式的report,但是如果是在batchtest下面,如果所有的测试用例都执行完了,就会生成一系列的HTML报告,举例:

<target name="test"depends="compile-tests"description="Compile and execute the JUnit tests."><mkdir dir="build/testoutput"/><junit printsummary="on" fork="${test.fork}"forkmode="once" showoutput="true"failureproperty="junit.failure"><jvmarg value="-XX:-UseSplitVerifier"/><classpath refid="allclasspath.path" /><classpath><pathelement location="${build.dir}/test" /></classpath><jvmarg value="-javaagent:lib\aspectjweaver-1.6.11.jar"/><batchtest todir="build/testoutput"><formatter type="brief" usefile="false" /><formatter type="xml" /><fileset dir="${build.dir}/test"><include name="**/${test.class}.class" /></fileset></batchtest></junit><junitreport><fileset dir="build/testoutput" includes="*.xml"/><report todir="build/testoutput"/></junitreport><fail if="junit.failure"message="Unit tests failed. See build/testoutput/index.html" />
</target>

就这么点经验,总结一下。

  相关解决方案