ant junit 任务不报告详细信息
2022-09-01 18:48:07
我试图用JUnit测试写一个蚂蚁,但得到以下结果:
unittest:
[junit] Running com.mytest.utiltest
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
[junit] Test com.mytest.utiltest FAILED
它只是显示错误而没有打印细节,我在构建中指定了以下参数.xml也尝试以开始,但没有得到任何运气。任何人都可以帮忙吗?ant -v or ant -debug
<junit printsummary="yes" showoutput="true">
蚂蚁 1.8.2, 太阳jdk1.6.0_20, 朱尼特 4.8.2
为了缩小问题的范围,我创建了一个单独的项目,这是我的构建.xml
<project name = "TestPrj" default="unittest" basedir = ".">
<target name="unittest" >
<junit printsummary="yes" showoutput="true" >
<classpath>
<pathelement location="./junit-4.8.2.jar"/>
<pathelement location="./ant-junit4.jar"/>
</classpath>
<test name = "com.mytest.unittest.SimpleTest" todir="."/>
</junit>
</target>
</project>
下面是最简单的.java
package com.mytest.unittest;
import junit.framework.TestCase;
public class SimpleTest extends TestCase{
public void testFirst()
{
assertTrue(true);
}
}
C:\TestPrj>ant
Buildfile: C:\TestPrj\build.xml
unittest:
[junit] Running com.mytest.unittest.SimpleTest
[junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0 sec
BUILD SUCCESSFUL
Total time: 0 seconds
C:\TestPrj>dir
Directory of C:\TestPrj
04/02/2011 02:00 PM <DIR> .
04/02/2011 02:00 PM <DIR> ..
04/02/2011 01:56 PM 280 .classpath
04/02/2011 01:54 PM 519 .project
04/02/2011 02:00 PM 7,120 ant-junit4.jar
04/02/2011 02:00 PM 403 build.xml
04/02/2011 01:55 PM <DIR> com
11/17/2010 05:36 PM 237,344 junit-4.8.2.jar
5 File(s) 245,666 bytes
3 Dir(s) 28,451,311,616 bytes free
为什么没有生成 JUnit 结果/详细信息/报告?因此,在我实际失败的情况下,我无法解决我的问题?