ant 排除文件
我必须为 Junit 报告编写一个 ant 目标。这是一个现有的应用程序。一些测试类文件被命名为 TestSample.java 或 SampleTest.java。但是有一些与junit测试用例不做任何事情的java文件被编写为HeaderTest.java,它不扩展TestCase。
我如何过滤这些类文件?
<junit printsummary="on" fork="off" haltonfailure="false" showoutput="true">
<classpath>
<path refid="CLASSPATH_JUNIT"/>
</classpath>
<batchtest fork="off" todir="${BUILD_TEST_DIR}">
<fileset dir="${TEST_CLASSES_DIR}">
<include name="**/*Test.class" />
<include name="**/Test*.class" />
</fileset>
</batchtest>
<formatter type="xml" />
</junit>
I have to write an ant target for Junit report. It is an existing application. Some of the Test class files are named as TestSample.java or SampleTest.java. But there are some few java files which are not to do anything with junit testcases are written HeaderTest.java which doesnt extending TestCase.
How can i filter these calss files?
<junit printsummary="on" fork="off" haltonfailure="false" showoutput="true">
<classpath>
<path refid="CLASSPATH_JUNIT"/>
</classpath>
<batchtest fork="off" todir="${BUILD_TEST_DIR}">
<fileset dir="${TEST_CLASSES_DIR}">
<include name="**/*Test.class" />
<include name="**/Test*.class" />
</fileset>
</batchtest>
<formatter type="xml" />
</junit>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
fileset
也有一个exclude
。fileset
has anexclude
as well.使用
显式排除它们,或者更好的是,重构它们,以便它们遵循命名约定:*测试类应该是测试用例。请参阅http://ant.apache.org/manual/Types/fileset.html
Exclude them explicitely with
<exclude name="**/HeaderTest.class"/>
, or even better, refactor them so that they respect the naming convention : *Test classes should be test cases.See http://ant.apache.org/manual/Types/fileset.html