I have the following build.xml file
<property file="build.properties"/>
<property name="src.dir" value="src"/>
<property name="build.dir" value="classes"/>
<property name="web.dir" value="war"/>
<property name="test.dir" value="test"/>
<path id="build.classpath">
<fileset dir="lib">
<include name="*.jar"/>
</fileset>
<!-- servlet API classes: -->
<fileset dir="${appserver.lib}">
<include name="servlet*.jar"/>
</fileset>
<pathelement path="${build.dir}"/>
<pathelement path="${test.dir}"/>
</path>
<path id="classpath.base"/>
<path id="classpath.test">
<pathelement location="c:/ant/lib/junit.jar" />
<pathelement location="${build.dir}"/>
<pathelement location="${src.dir}"/>
<pathelement location="${test.dir}" />
<pathelement location="classes"/>
<path refid="classpath.base" />
</path>
<target name="build">
<!-- Following two lines creat src and test folders in WEB/INF folders -->
<mkdir dir="${build.dir}"/>
<mkdir dir="${test.dir}"/>
<javac destdir="${build.dir}" source="1.5" target="1.5" debug="true" deprecation="false" optimize="false" failonerror="true">
<src path="${src.dir}"/>
<classpath refid="build.classpath"/>
</javac>
<javac destdir="${build.dir}" source="1.5" target="1.5" debug="true" deprecation="false" optimize="false" failonerror="true">
<src path="${test.dir}"/>
<classpath refid="build.classpath"/>
</javac>
</target>
<target name="test">
<junit haltonfailure="true" printsummary="yes">
<classpath refid="classpath.test" />
<classpath refid="build.classpath"/>
<formatter type="brief" usefile="false" />
<batchtest fork="yes">
<fileset dir="${test.dir}">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
</junit>
and I have the following test class just to test out the build
package com.mmz.mvc.test; import junit.framework.*; public class MemberDAOTest extends TestCase { public void test1(){ assertTrue("Test didn't work",false); } }
Obviously this test is supposed to fail, but its not. Can anybody tell me why I am getting the following output. Also, if there is something you see wrong, then please let me know if I can improve my build script, I am new to writing any build files.
test: [junit] Running com.mmz.mvc.test.MemberDAOTest [junit] Testsuite: com.mmz.mvc.test.MemberDAOTest [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.018 sec [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.018 sec BUILD SUCCESSFUL Total time: 1 second