ant excluding files

牧云@^-^@ 提交于 2020-01-04 04:17:24

问题


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>

回答1:


fileset has an exclude as well.

<exclude name="**/DoNotIncludeThisOne.class" />



回答2:


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



来源:https://stackoverflow.com/questions/6109564/ant-excluding-files

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!