Ant - Junit

Card Puncher Data Processing

Support

The classpath for junit must include junit.jar if not in Ant's own classpath

In the build file

In the buildfile, just add to the classpath element the junit.jar.

Example:

<!-- Add the test jar (junit and testng) -->
<path id="test.class.path">
	<path refid="classpath.base" />
	<fileset dir="${test.lib}">
		<include name="**/junit*.jar" />
		<include name="**/*test*.jar" />
	</fileset>
</path>

<!-- Run the test and design the test.class.path -->
<target name="test" depends="create">
	<junit printsummary="true" haltonfailure="no">
		<classpath refid="test.class.path" />
		<formatter type="plain" usefile="false" />
		<test name="junit/HelloWorld" haltonfailure="no" outfile="junitout/HelloWorld" />
	</junit>
</target>

With eclipse

Add junit.jar in the configuration path.







Share this page:
Follow us:
Task Runner