I have a problem with my unit test, and I don't have a clue why. When I run my unit test normally in eclipse it runs perfectly fine. But when I try to build my project using ant, there is a unit test that fails.
The only information that I get from it is that the test failed, I don't know why or on what line.
Is there a way for me to let ant tell me what went wrong (and on which line)?
This is my unit test target:
<target name="unit.test"
depends="jar"
description="'jar', 'compile', and run unit tests">
<junit printsummary="on" failureproperty="unit.test.failed" timeout="300000">
<jvmarg value="-Dtest.resource.dir=${resource.dir}/test"/>
<jvmarg value="-Dresource.dir=${resource.dir}"/>
<jvmarg value="-Djava.awt.headless=true"/>
<classpath >
<pathelement location="${debug.class.dir}"/>
<pathelement location="${resource.test.dir}"/>
<pathelement location="${resource.dir}"/>
<pathelement location="${library.release.dir}/${junit.jar}"/>
<filelist refid="test.imports"/>
<filelist refid="imports"/>
</classpath>
<formatter type="xml"/>
<batchtest fork="yes" todir="${release.test.dir}">
<fileset dir="${source.dir}">
<include name="test/unit/**/*Test.java" unless="test.unit"/>
<include name="test/unit/**/${test.unit}Test.java" if="test.unit"/>
<exclude name="test/unit/**/Abstract*.java"/>
</fileset>
</batchtest>
</junit>
<fail message="one or more unit test failed" if="unit.test.failed"/>
</target>
This is what it looks like in my console:
unit.test:
[junit] Running test.unit.com.bazinga.sensormonitor.IBoxSensorDeviceTest [junit] Tests run: 9, Failures: 0, Errors: 0, Time elapsed: 4.049 sec [junit] Running test.unit.com.bazinga.sensormonitor.M2MSensorDeviceTest [junit] Tests run: 3, Failures: 0, Errors: 0, Time elapsed: 1.586 sec [junit] Running test.unit.com.bazinga.sensormonitor.RMoniSensorDeviceTest [junit] Tests run: 21, Failures: 0, Errors: 1, Time elapsed: 5.385 sec [junit] Test test.unit.com.bazinga.sensormonitor.RMoniSensorDeviceTest FAILED [junit] Running test.unit.com.bazinga.sensormonitor.SensiteSensorDeviceTest [junit] Tests run: 7, Failures: 0, Errors: 0, Time elapsed: 1.303 sec [junit] Running test.unit.com.bazinga.sensormonitor.TBoxSensorDeviceTest [junit] Tests run: 10, Failures: 0, Errors: 0, Time elapsed: 2.055 sec
BUILD FAILED
/home/user/projects/bazinga/admin/build/ant-library.xml:150: one or more unit test failed
Thanks for your help.