All I am sure this has been answered before why does haltOnFailure
when set to true not fail when the any tasks fail
I have the following target
<junit haltonerror="false" haltOnFailure="true" fork="yes"
showoutput="true" failureproperty="test.failed">
<classpath>
<path refid="classpath.test"/>
</classpath>
<formatter type="brief" usefile="false" />
<batchtest fork="yes" >
<fileset dir="${src.tests}">
<include name="**/*TestCase.java"/>
</fileset>
</batchtest>
</junit>
BUt when i run the test I get
[junit] Testsuite: com.test.NetworkServerInitialisationTestCase
[junit] Tests run: 4, Failures: 0, Errors: 1, Time elapsed: 0.405
sec
[junit]
[junit] Testcase: TestTheServerHasStoppedCorrectly
(com.test.NetworkServerInitialisationTestCase): Caused an ERROR
[junit]
[junit] java.lang.AssertionError:
[junit] at org.junit.Assert.fail(Assert.java:92)
[junit] at org.junit.Assert.assertTrue(Assert.java:44)
[junit] at org.junit.Assert.assertFalse(Assert.java:69)
[junit] at org.junit.Assert.assertFalse(Assert.java:80)
[junit] at
test.NetworkServerInitialisationTestCase.TestTheServerHasStoppedCorrectly
(NetworkServerInitialisationTestCase.java:99)
[junit] at org.junit.runners.model.FrameworkMethod
$1.runReflectiveCall(FrameworkMethod.java:44)
[junit] at
org.junit.internal.runners.model.ReflectiveCallable.run
(ReflectiveCallable.java:15)
[junit] at
org.junit.runners.model.FrameworkMethod.invokeExplosively
(FrameworkMethod.java:41)
[junit] at
org.junit.internal.runners.statements.InvokeMethod.evaluate
(InvokeMethod.java:20)
[junit] at
org.junit.internal.runners.statements.RunBefores.evaluate
(RunBefores.java:28)
[junit] at
org.junit.internal.runners.statements.RunAfters.evaluate
(RunAfters.java:31)
[junit] at org.junit.runners.BlockJUnit4ClassRunner.runChild
(BlockJUnit4ClassRunner.java:70)
[junit] at org.junit.runners.BlockJUnit4ClassRunner.runChild
(BlockJUnit4ClassRunner.java:44)
[junit] at org.junit.runners.ParentRunner.runChildren
(ParentRunner.java:180)
[junit] at org.junit.runners.ParentRunner.access$000
(ParentRunner.java:41)
[junit] at org.junit.runners.ParentRunner$1.evaluate
(ParentRunner.java:173)
[junit] at
org.junit.internal.runners.statements.RunBefores.evaluate
(RunBefores.java:28)
[junit] at
org.junit.internal.runners.statements.RunAfters.evaluate
(RunAfters.java:31)
[junit] at org.junit.runners.ParentRunner.run(ParentRunner.java:
220)
[junit] at junit.framework.JUnit4TestAdapter.run
(JUnit4TestAdapter.java:39)
[junit]
default:
BUILD SUCCESSFUL
Total time: 23 seconds
When I run it in debug I can see the haltOnFailure is set to false and
my property failureproperty is not set
'org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner'
'com.test.NetworkServerInitialisationTestCase'
'filtertrace=true'
'haltOnError=false'
'haltOnFailure=false'
'showoutput=true'
'formatter
=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter'
'propsfile=/Users/junit322862163.properties'
The ' characters around the executable and arguments are
not part of the command.
[junit] Testsuite: com.test.NetworkServerInitialisationTestCase
[junit] Tests run: 4, Failures: 0, Errors: 1, Time elapsed: 0.423
sec
[junit]
I am using ant 1.7.1