T
Tim
I've got Ant/JUnit working so that it compiles, creates an executable
jar file and runs a JUnit test class.
My question is...how does it know where to find the test class? I don't
seem to be specifying it anywhere that I can see.
<?xml version="1.0"?>
<project name="test" default="compile"
basedir="C:/JDeveloper/jdev/mywork/WorkspaceBeans/Project3">
<property name="src" value="src"/>
<property name="build" value="classes"/>
<property name="dist" value="dist"/>
<path id="classpath">
<fileset dir="C:/JDeveloper">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="compile"
description="compile the source " >
<javac srcdir="${src}" destdir="${build}" >
<include name="*.java" />
<classpath refid="classpath"/>
</javac>
</target>
<target name="dist" depends="compile"
description="generate the distribution" >
<!-- Put everything in ${build} into the MyProject.jar file -->
<jar jarfile="${dist}/MyProjectX.jar" basedir="${build}">
<manifest>
<attribute name="Main-Class"
value="junitTest.HelloWorldTest"/>
<attribute name="Class-Path" value="junit.jar"/>
</manifest>
</jar>
</target>
<!-- This one runs junitTest.HelloWorldTest non-graphically -->
<target name="junit" depends="dist">
<property name="testclass" value="junitTest.HelloWorldTest"/>
<java classname="junit.textui.TestRunner">
<arg value="${testclass}"/>
<classpath>
<fileset dir="C:/JDeveloper"
includes="**/*.jar"/>
</classpath>
</java>
</target>
</project>
jar file and runs a JUnit test class.
My question is...how does it know where to find the test class? I don't
seem to be specifying it anywhere that I can see.
<?xml version="1.0"?>
<project name="test" default="compile"
basedir="C:/JDeveloper/jdev/mywork/WorkspaceBeans/Project3">
<property name="src" value="src"/>
<property name="build" value="classes"/>
<property name="dist" value="dist"/>
<path id="classpath">
<fileset dir="C:/JDeveloper">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="compile"
description="compile the source " >
<javac srcdir="${src}" destdir="${build}" >
<include name="*.java" />
<classpath refid="classpath"/>
</javac>
</target>
<target name="dist" depends="compile"
description="generate the distribution" >
<!-- Put everything in ${build} into the MyProject.jar file -->
<jar jarfile="${dist}/MyProjectX.jar" basedir="${build}">
<manifest>
<attribute name="Main-Class"
value="junitTest.HelloWorldTest"/>
<attribute name="Class-Path" value="junit.jar"/>
</manifest>
</jar>
</target>
<!-- This one runs junitTest.HelloWorldTest non-graphically -->
<target name="junit" depends="dist">
<property name="testclass" value="junitTest.HelloWorldTest"/>
<java classname="junit.textui.TestRunner">
<arg value="${testclass}"/>
<classpath>
<fileset dir="C:/JDeveloper"
includes="**/*.jar"/>
</classpath>
</java>
</target>
</project>