C:\Users\Vaibhav\Eclipse_Workspace\WebDriverTests>ant run
Buildfile: C:\Users\Vaibhav\Eclipse_Workspace\WebDriverTests \build.xml
运行:
[junitreport] Processing D:\reports\TESTS-TestSuites.xml to C:\Users\Vaibhav\AppData\Local\Temp\null526641997
[junitreport] Loading stylesheet jar:file:/C:/apache-ant-1.9.4/lib/ant-junit.jar
!/org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-frames.xsl
[junitreport] Transform time: 524ms
[junitreport] Deleting: C:\Users\Vaibhav\AppData\Local\Temp\null526641997
BUILD SUCCESSFUL
Total time: 1 second
的build.xml
<property name="wspace.home" value="${basedir}"/>
<property name="wspace.jars" value="D:\\softwares\\jars"/>
<property name="test.dest" value="${wspace.home}/build"/>
<property name="test.src" value="${wspace.home}/src"/>
<property name="test.reportsDir" value="D:\reports"/>
<path id="testcase.path">
<pathelement location="${test.dest}"/>
<fileset dir="${wspace.jars}">
<include name="*.jar"/>
</fileset>
</path>
<target name="setClassPath" unless="test.classpath">
<path id="classpath_jars">
<fileset dir="${wspace.jars}" includes="*.jar"/>
</path>
<pathconvert pathsep="."
property="test.classpath"
refid="classpath_jars"/>
</target>
<target name="init" depends="setClassPath">
<tstamp>
<format property="start.time" pattern="MM/dd/yyyy hh:mm aa" />
</tstamp>
<condition property="ANT"
value="${env.ANT_HOME}/bin/ant.bat"
else="${env.ANT_HOME}/bin/ant">
<os family="windows" />
</condition>
</target>
<!-- all -->
<target name="all">
</target>
<!-- clean -->
<target name="clean">
<delete dir="${test.dest}"/>
</target>
<!-- compile -->
<target name="compile" depends="init, clean">
<delete includeemptydirs="true" quiet="true">
<fileset dir="${test.dest}" includes="**/*"/>
</delete>
<echo message="making directory..."/>
<mkdir dir="${test.dest}"/>
<echo message="classpath-----: ${test.classpath}"/>
<echo message="compiling..."/>
<javac
debug="true"
destdir="${test.dest}"
srcdir="${test.src}"
target="1.7"
classpath="${test.classpath}"
>
</javac>
</target>
<!-- build -->
<target name="build" depends="init">
</target>
<target name="usage">
<echo>
ant run will execute the test
</echo>
</target>
<path id="test.c">
<fileset dir="${wspace.jars}" includes="*.jars"/>
</path>
<!-- run -->
<target name="run">
<delete includeemptydirs="true" quiet="true">
<fileset dir="${test.reportsDir}" includes="**/*"/>
</delete>
<java jar="${wspace.jars}" fork="true" spawn="true"/>
<junit fork="yes" haltonfailure="no" printsummary="yes">
<classpath refid="testcase.path"/>
<!-- <classpath ="&{test.classpath}"/> -->
<batchtest todir="${test.reportsDir}" fork="true">
<fileset dir="${test.dest}">
<include name="TestSuite.class"/>
</fileset>
</batchtest>
<formatter type="xml"/>
<classpath refid="testcase.path"/>
</junit>
<junitreport todir="${test.reportsDir}">
<fileset dir="${test.reportsDir}">
<include name="TEST-.xml" />
</fileset>
<report todir="${test.reportsDir}"/>
</junitreport>
</target>
</project>