0
在一個項目中,我有一個用於所有應用程序源代碼的文件夾src和一個用於所有junit測試的不同文件夾測試(均使用simular包層次結構)。使用junit測試的Ant build.xml的佈局
現在我希望Ant能夠在測試文件夾中運行所有測試,但問題是現在還包含了文件名中帶有「Test」的src文件夾中的文件。
這是build.xml中的測試目標:
<target name="test" depends="build">
<mkdir dir="reports/tests" />
<junit fork="yes" printsummary="yes">
<formatter type="xml"/>
<classpath>
<path location="${build}/WEB-INF/classes"/>
<fileset dir="${projectname.home}/lib">
<include name="servlet-api.jar"/>
<include name="httpunit.jar"/>
<include name="Tidy.jar"/>
<include name="js.jar"/>
<include name="junit.jar"/>
</fileset>
</classpath>
<batchtest todir="reports/tests">
<fileset dir="${build}/WEB-INF/classes">
<include name="**/*Test.class"/>
</fileset>
</batchtest>
</junit>
</target>
而且我已經加入了測試文件夾到構建目標:
<target name="build" depends="init,init-props,prepare">
<javac source="1.5" debug="true" destdir="${build}/WEB-INF/classes">
<src path="src" />
<src path="test" />
<classpath refid="classpath"/>
</javac>
</target>