0
我已經創建了一個構建文件,並根據我的項目(Selenium和Junit)進行配置。 現在的問題是,當我運行構建文件,它只運行第一類,並保存在HTML報告中。 任何人都可以告訴我做錯了什麼,應該編輯/或更換什麼?運行所有類,並將所有執行數據保存在報告中,並使用ant和Junit
<?xml version="1.0" encoding="UTF-8"?>
<project name="ant" default="exec" basedir=".">
<property name="src" value="./src" />
<property name="lib" value="./lib" />
<property name="bin" value="./bin" />
<property name="report" value="./report" />
<path id="ant.classpath">
<pathelement location="${bin}" />
<fileset dir="${lib}">
<include name="**/*.jar" />
<include name="C:/Users/bhmehta/workspace/ant/lib/libs/*.jar" />
</fileset>
</path>
<target name="init">
<delete dir="${bin}" />
<mkdir dir="${bin}" />
</target>
<target name="compile" depends="init" description="compile the source " >
<!-- Compile the java code from ${src} into ${build} -->
<javac debug="true"
srcdir="${src}"
destdir="${bin}"
includeantruntime="false"
classpathref="ant.classpath"/>
<!-- Copy files from ${src} into ${build} -->
<copy todir="${bin}">
<fileset dir="${src}">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="exec" depends="compile">
<delete dir="${report}" />
<mkdir dir="${report}" />
<mkdir dir="${report}/xml" />
<junit
printsummary="yes"
haltonfailure="no"
>
<classpath><pathelement location="${ant.classpath}" /> </classpath>
<test name="testing.demo" haltonfailure="no" todir="${report}/xml" outfile="TEST-result">
<formatter type="xml" />
</test>
<test name="testing.demo1" haltonfailure="no" todir="${report}/xml" outfile="TEST-result">
<formatter type="xml" />
</test>
</junit>
<junitreport todir="${report}">
<fileset dir="${report}/xml">
<include name="TEST*.xml" />
</fileset>
<report format="frames" todir="${report}/html" />
</junitreport>
</target>
</project>
我也嘗試了一些給類似的問題的解決方案,使用<batchtest </batchtest>
標籤。但它顯示錯誤像
The <junit> type doesn't support ne sted text data (">").
我真的不知道這是什麼。 請幫忙一下
謝謝@邁克爾,它執行得很好,但報告是空白的。 – Bhomik
我已經做了更新。請試一試。 –
Nopes邁克爾,我仍然得到報告如下「測試\t失敗\t錯誤\t跳過\t成功率\t時間爲NaN \t 0.000」 – Bhomik