【问题标题】:BatchTest (Ant) not "executing" JUnit testsBatchTest (Ant) 没有“执行”JUnit 测试
【发布时间】:2015-01-13 20:12:59
【问题描述】:

以下 ANT 脚本执行提到的 2 个测试:

<target name="tests">
    <mkdir dir="${junit.output.dir}"/>
    <junit fork="yes" printsummary="withOutAndErr">
        <formatter type="xml"/>
        <test name="x.atest" todir="${junit.output.dir}"/>
        <test name="x.ytest" todir="${junit.output.dir}"/>              
        <classpath refid="ab.classpath"/>
    </junit>
</target>

但是,当我尝试将其更改为 BatchTest 时,它会成功构建但不会执行测试:

<target name="tests">
    <mkdir dir="${junit.output.dir}"/>
    <junit fork="yes" printsummary="withOutAndErr">
        <formatter type="xml"/>
        <batchtest todir="${junit.output.dir}" fork="yes">
            <fileset dir="${tests.dir}">
                <include name="**/.class" />
            </fileset>
        </batchtest>
        <classpath refid="ab.classpath"/>
    </junit>
</target>

我现在失去了理智,因为这里可能缺少什么。有人可以帮忙吗?

【问题讨论】:

    标签: java unit-testing ant junit4


    【解决方案1】:

    没有看到 ${tests.dir} 中的内容,我真的无法判断,但 ${tests.dir} 是否包含已编译的单元测试或测试的源代码?如果是后者,请尝试将 &lt;include name="**/.class" /&gt; 更改为 &lt;include name="**/.java" /&gt; 或将文件集的 dir 属性指向已编译测试输出到的任何位置

    【讨论】:

      猜你喜欢
      • 2015-08-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多