![](/img/trans.png)
[英]JUnit HTML report (index.html) is not generated in the JUNIT folder, If I run the test case through ANT in eclipse
[英]Junit + Ant + Eclipse unit test attempts to run but always returns 1 execution
我有一个通过Eclipse运行的ant任务,无法正确执行测试用例。 Ant的输出如下:
[junit] Running my.custom.test.GoTest
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 seconds
[junit] Test my.custom.test.GoTest FAILED
最小可能的Ant脚本:
<project>
<target name="test">
<javac srcdir="Test/src" destdir="Test/bin" />
<junit fork="true" printsummary="true">
<batchtest>
<fileset dir="Test/test">
<include name="**/*Test.*"/>
</fileset>
</batchtest>
</junit>
</target>
</project>
Java文件:
package my.custom.test
public class GoTest
{
@Test
public void test_1() throws Exception
{
assertTrue(true);
}
@Test
public void test_2() throws Exception
{
assertFalse(false);
}
}
我希望以上来自ant junit任务的输出产生正在运行的两个测试。 但是,只有一个正在运行。 我正在寻找有关发生这种情况的任何原因,或者是否缺少我遇到的配置问题。
如果其他人遇到了完全相同的问题或非常相似的问题,则以下更改将大有裨益:
<junit fork="true" printsummary="true">
<formatter type="plain" usefile="false" />
<batchtest>
<fileset dir="Test/test">
<include name="**/*Test.*"/>
</fileset>
</batchtest>
</junit>
这导致我一个ClassNotFoundException
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.