Olegas
Olegas

Reputation: 10517

Ant build target is failing after first junit task

I have an Ant build target that performs some testing using jUnit4

   <target name="integrationtest" depends="init, buildtests, deploytests">
      <junit haltonfailure="false">
         <sysproperty key="driver" value="org.openqa.selenium.firefox.FirefoxDriver" />
         <sysproperty key="screenshotDir" value="${screenshotsDir}" />
         <classpath>
            <pathelement location="${interfaceTestJar}"/>
         </classpath>
         <batchtest>
            <fileset dir="${interfaceTestClasses}">
               <include name="**/tests/Test*.class" />
            </fileset>
         </batchtest>
      </junit>

      <junit haltonfailure="false">
         <sysproperty key="driver" value="org.openqa.selenium.ie.InternetExplorerDriver" />
         <classpath>
            <pathelement location="${interfaceTestJar}"/>
         </classpath>
         <batchtest>
            <fileset dir="${interfaceTestClasses}">
               <include name="**/tests/Test*.class" />
            </fileset>
         </batchtest>
      </junit>

      <echo message="##teamcity[publishArtifacts '${artifactsDir}']" />
   </target>

First junit task is always started, but if there is any failed tests in it, the second one isn't starts (exepected to start in any case, even if first one has failed tests)

EDIT: Seems like there is another problem. Second jUnit is not started in any case (if first is succeed or failed). In my TeamCity build log i see the following lines

[integrationtest] junit
[20:06:14]: [junit] ru.company.tests.TestDateField
[20:06:30]: [junit] Process exited with code 255

TestDateField is my first test suite. After it there are some more suites and they all succeed (and the first one too).

Upvotes: 1

Views: 1000

Answers (3)

KIR
KIR

Reputation: 5702

Is there a chance your test does something like System.exit? Did you try adding fork="true" to your junit task, so it will run in a separate JVM?

Upvotes: 1

Raghuram
Raghuram

Reputation: 52665

As per the docs, haltonfailure should be yes or no.

Upvotes: 0

JuanZe
JuanZe

Reputation: 8167

I think you should use <junit haltonfailure="no"> instead of <junit haltonfailure="false">

Upvotes: 0

Related Questions