因此,我使用JUnit设置了自动回归测试,现在构建脚本设置为调用TestSuite,它将一堆不同的测试打包到TestSuite中并返回它。Ant,JUnit和TestSuite
构建文件:
<target name="test-perform-check" depends="test-compile">
<junit printsummary="yes" fork="yes" haltonfailure="no">
<classpath path ="${mypath}" />
<jvmarg value="-Djava.ext.dirs=${extstar};${extpathextended};" />
<jvmarg value="-Dmipav=${mipav};" />
<sysproperty key="mipav" value="${mipav}"/>
<formatter type="xml"/>
<formatter type="plain" usefile="false"/>
<test name="test.JTest"/>
</junit>
</target>
JTest.java:
class JTest extends TestSuite {
public static Test suite() {
// set up a bunch of stuff
TestSuite suite = new TestSuite();
suite.addTest(new VolumeCompare());
suite.addTest(new VolumeCompare());
suite.addTest(new VolumeCompare());
suite.addTest(new FileExistence());
// do some other stuff
return suite;
}
}
输出:
[junit] Testcase: null took 0.002 sec
[junit] FAILED
[junit] null
[junit] junit.framework.AssertionFailedError
[junit]
[junit] Testcase: null took 0 sec
[junit] FAILED
[junit] null
[junit] junit.framework.AssertionFailedError
[junit]
[junit] Testcase: null took 0.002 sec
[junit] FAILED
[junit] null
[junit] junit.framework.AssertionFailedError
[junit]
[junit] Testcase: null took 0 sec
[junit] FAILED
[junit] null
[junit] junit.framework.AssertionFailedError
[junit]
[junit] Test test.JTest FAILED
我的问题是 - 什么,我需要在buildscript改变,使蚂蚁运行测试正确吗?
编辑:
VolumeCompare.java:
public class VolumeCompare extends TestCase {
public VolumeCompare (...) {
// ctor
}
@Test
public void testVolume() {
// this print statement is never reached
System.out.println("testing volume");
// compare volumes here
}
}
你可以发布你的'VolumeCompare.java'文件吗? –
已发布。如果我设法修复它,我会把它扔在那里。 – ellioth