Running JUnit using Ant
by , 05-21-2011 at 10:26 PM (1517 Views)
You may want to define build script using ant for your application. I will write about how to create ant script to run ant.
Step 1: define ant properties
Step 2: set CLASSPATH to be used by JUnitXML Code:<property name="src" value="./src" /> <property name="lib" value="./lib" /> <property name="classes" value="./classes" /> <property name="test.class.name" value="com.xyz.MyTestSuite" />
Step 3: define the ant task for running JUnitXML Code:<path id="test.classpath"> <pathelement location="${classes}" /> <pathelement location="/path/to/junit.jar" /><fileset dir="${lib}"> <include name="**/*.jar"/> </fileset> </path>
Step 4: run the testXML Code:<target name="test"> <junit fork="yes" haltonfailure="yes"> <test name="${test.class.name}" /> <formatter type="plain" usefile="false" /> <classpath refid="test.classpath" /> </junit> </target>
Java Code:ant test









Email Blog Entry
License4J 4.0
Yesterday, 12:23 AM in Java Software