从罐子蚂蚁的JUnit batchtest [英] ant junit batchtest from a jar

查看:203
本文介绍了从罐子蚂蚁的JUnit batchtest的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用蚂蚁(发布1.7)在名为类运行所有测试*的Test.class在一定的罐子。

类似如下(虽然它实际上并没有运行任何测试):

 < JUnit的叉=YESprintsummary关于haltonfailure关于&GT = =;
        <格式化类型=XML/>
        < batchtest叉=YEStodir =$ {} junit.output.dir>
            <资源>
               < ZipEntry的压缩文件=测试 - only.jarNAME =** / *的Test.class/>
            < /资源>
        < / batchtest>
        <类路径REFID =testsplus.classpath/>
    < / JUnit的>

什么是资源/ ZipEntry的部分正确的语法?

蚂蚁文档说:


  

batchtest收集包括
  从任何数目的嵌套资源
  资源集合。然后,它
  为每个测试类的名称
  资源以.java或结束的.class


  
  

任何类型的资源集合的是
  支持作为嵌套元素,前
  到Ant 1.7仅<&文件集GT;
  支持。



解决方案
而不是的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"/>

这篇关于从罐子蚂蚁的JUnit batchtest的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆