Итак, я настраиваю автоматическое регрессионное тестирование с помощью JUnit, и сейчас сценарий сборки настроен для вызова TestSuite, который упаковывает кучу разных тестов в 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
Мой вопрос - что мне нужно изменить в сценарии сборки, чтобы сделать antправильно запустить тесты?
Редактировать:
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
}
}