ant excluding files

2019-07-04 02:04发布

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>

标签: ant junit
2条回答
Anthone
2楼-- · 2019-07-04 02:35

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

查看更多
forever°为你锁心
3楼-- · 2019-07-04 02:37

fileset has an exclude as well.

<exclude name="**/DoNotIncludeThisOne.class" />
查看更多
登录 后发表回答