I have a custom JUnit runner with listener RunListener
. In eclipse environment this testRunFinished(Result result)
listener works as expected, but when I run it through ANT this listener is not initialized. Added in build.xml special annotation enableTestListenerEvents="true"
but this did help.
Here is my runner's piece of the code:
@Override
public void run(RunNotifier notifier) {
notifier.addListener(new RunListener(){
@Override public void testRunFinished(Result result) throws Exception {
super.testRunFinished(result);
}
}
);
}
and build.xml:
<junit printsummary="yes" haltonfailure="no" fork="yes" enableTestListenerEvents="true">
Any help would be much appreciated.
EDIT: Btw, @Override public void testStarted(Description description) throws Exception {..}
works fine, seems only testRunFinished
is not working properly. Same bug, as I understood it hasn't been fixed yet: https://issues.apache.org/bugzilla/show_bug.cgi?id=54970 My ANT version is 1.9.4, tried also 1.8.4.
are the tests within main.test.java directory? if yes then it might be a problem of build.xml configuration, see exemple
You might need to specify the test classes
<batchtest fork="yes" todir="${reports.tests}">
<fileset dir="${src.test}">
<include name="**/*Test*.java"/>
</fileset>
</batchtest>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.