且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从罐子蚂蚁的JUnit batchtest

更新时间:2023-11-20 08:45:10

而不是的ZipEntry

您或许可以使用 zipfileset 数据类型:

 < zipfileset SRC =测试 -  only.jar包括=** / *的Test.class/>

I'd like to use ant (post 1.7) to run all tests in classes named *Test.class in a certain jar.

Something like the following (although it doesn't actually run any tests):

    <junit fork="yes" printsummary="on" haltonfailure="on">
        <formatter type="xml"/>
        <batchtest fork="yes" todir="${junit.output.dir}">
            <resources>
               <zipentry zipfile="tests-only.jar" name="**/*Test.class"/>
            </resources> 
        </batchtest>            
        <classpath refid="testsplus.classpath"/>
    </junit>

What is the correct syntax for the resources/zipentry part?

The ant docs say:

batchtest collects the included resources from any number of nested Resource Collections. It then generates a test class name for each resource that ends in .java or .class.

Any type of Resource Collection is supported as a nested element, prior to Ant 1.7 only <fileset> has been supported.

Instead of zipentry you can probably use the zipfileset datatype:

<zipfileset src="tests-only.jar" includes="**/*Test.class"/>