使用ANT运行jUnit-如何在不使用@Suite的情况下执行所有测试?
我希望执行/test目录中的所有测试,而不使用诸如使用ANT运行jUnit-如何在不使用@Suite的情况下执行所有测试?,ant,junit,Ant,Junit,我希望执行/test目录中的所有测试,而不使用诸如 @Suite.SuiteClasses( ....) 在过去,我只有一个类,它调用许多其他类来测试它们。这种做法已不可接受 我有一个/test目录,下面有许多包,每个包都包含几个测试 在我当前的ANT脚本中,我有: <target name="compileTest" depends="compile" description="compile jUnit"> <javac srcdir="${test}" dest
@Suite.SuiteClasses( ....)
在过去,我只有一个类,它调用许多其他类来测试它们。这种做法已不可接受
我有一个/test目录,下面有许多包,每个包都包含几个测试
在我当前的ANT
脚本中,我有:
<target name="compileTest" depends="compile" description="compile jUnit">
<javac srcdir="${test}" destdir="${bin}" includeantruntime="true" />
</target>
接
<target name="test" depends="compileTest">
<junit printsummary="yes" fork="no" haltonfailure="no">
<classpath location="${bin}" />
<formatter type="plain" />
</junit>
</target>
过去,我有
<test name="MyCollectionOfTests" />
我不想再这样了
我错过了什么?请告知。您可以使用嵌套的
批测试。例如:
<junit printsummary="on"
fork="on"
dir="${test.build}"
haltonfailure="false"
failureproperty="tests.failed"
showoutput="true">
<classpath>
<path refid="tests.classpath"/>
</classpath>
<batchtest todir="${test.report}">
<fileset dir="${test.gen}">
<include name="**/Test*.java"/>
</fileset>
<fileset dir="${test.src}">
<include name="**/Test*.java"/>
<exclude name="gen/**/*"/>
</fileset>
</batchtest>
</junit>
在其最简单的形式中,您只需添加一个嵌套的:
<batchtest todir="report">
<fileset dir="test"/>
</batchtest>
给你的junit打电话。这是一件美好的事情。。。非常感谢。