Call junit ui test with fork=true : JUnit « Ant « Java

Call junit ui test with fork=true

<?xml version="1.0"?>

<project name="yourName" default="junitgui" basedir=".">
  <property name="junitJar" value="\junit3.8.1\junit.jar" />
  <property name="src.dir" value="${basedir}\src" />
  <property name="build.dir" value="${basedir}\classes" />

  <path id="classpath">
    <pathelement location="${junitJar}" />
    <pathelement location="${build.dir}" />

  <target name="init">
    <mkdir dir="${build.dir}" />

  <target name="build" depends="init" description="build all">
        srcdir="${src.dir}" destdir="${build.dir}"
        deprecation="on" debug="on" optimize="off" includes="**">
      <classpath refid="classpath" />

  <target name="junitgui" depends="build" description="run junitgui">
    <java classname="junit.awtui.TestRunner" fork="yes">
      <arg value="sis.AllTests" />
      <classpath refid="classpath" />

   <target name="clean">  
    <delete dir="${build.dir}" />

   <target name="rebuildAll" depends="clean,build" description="rebuild all"/>


Related examples in the same category

1.Junit test
2.Junit report
3.Prepare the test directories
4.Use junit with call junit test cases