<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.5"
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>
Reoprs是生成的,但它们是空白的,尝试了不同的解决方案,提到的是以前的问题,但仍然无法得到。
我认为测试用例没有执行,是不是在build.xml中发现了错误
检查以下命令提示符日志
C: \Users\Vaibhav\Eclipse_Workspace\WebDriverTests>蚂蚁运行
构建文件:C:\Users\Vaibhav\Eclipse_Workspace\WebDriverTests\build.xml
运行:
[junistreport]正在将D:\reports\TESTS-TestSuites.xml处理为C:\Users\Vaibhav\AppData\Local\Temp\null52641997
[junistreport]正在加载样式表jar:file:/C:/apache-ant-1.94/lib/ant-junit.jar
/org/apache/tools/ant/taskdefs/optional/junit.xsl/junit-frames.xsl
[junistreport]转换时间:524ms
[junistreport]正在删除:C:\Users\Vaibhav\AppData\Local\Temp\null52641997
构建成功
总时间:1秒