您的位置:首页 > 其它

在ant中使用junit命令跑所有测试

2008-10-29 17:40 621 查看
<!--*************编译测试文件*****************-->

<target name="compile.functionalTest">

<mkdir dir="${build.dir}/functionalTest"/>

<javac srcdir="${basedir}/functionTest" destdir="${build.dir}/functionalTest" classpathref="app.classpath"/>

</target>

<!--******************************************-->

<target name="run.selenium.tests" depends="compile.functionalTest">

<mkdir dir="${basedir}/report" />

<!--**************这些属性可以参看ant的文档*************-->

<junit printsummary="on" haltonfailure="false" failureproperty="functional.tests.failed" showoutput="yes" reloading="false" fork="yes" forkmode="perBatch">

<classpath>

<!--**************这个路径指的是源文件编译后的class文件和配置文件*************-->

<pathelement path="${build.dir}/dest/WEB-INF/classes" />

<!--**************这个路径指的是测试文件编译后class文件*********************-->

<pathelement path="${build.dir}/functionalTest"/>

<!--**************这个路径指的是依赖的jar包*********************-->

<path refid="app.classpath" />

</classpath>

<formatter type="xml" />

<sysproperty key="log4j.configuration" value="log4j.properties" />

<sysproperty key="org.apache.commons.logging.Log" value="org.apache.commons.logging.impl.NoOpLog" />

<batchtest todir="${basedir}/report">

<fileset dir="${build.dir}/functionalTest">

<include name="**/*Test.class" />

</fileset>

</batchtest>

</junit>

<fail if="functional.tests.failed" message="One or more tests failed. See test output for details" />

</target>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: