跑步与QUOT;纯QUOT; JUnit 4测试用蚂蚁 [英] Running "pure" JUnit 4 tests using ant

查看:172
本文介绍了跑步与QUOT;纯QUOT; JUnit 4测试用蚂蚁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经迁移到双方的JUnit 4和蚂蚁1.7

We have migrated to both JUnit 4 and ant 1.7

测试运行在日食罚款,但使用蚂蚁运行测试时,注释会被忽略。

The tests runs fine in eclipse, but the annotations are ignored when running the tests using ant.

据蚂蚁junit任务文档

According to the Ant junit task documentation:

它也可以使用JUnit 4.0,其中只使用注释和无JUnit4TestAdapter中纯JUnit 4测试。

It also works with JUnit 4.0, including "pure" JUnit 4 tests using only annotations and no JUnit4TestAdapter.

但文件并没有对应该如何配置细说了。

But the documentation doesn't elaborate on how it should be configured.

有没有为junit任务所需要的任何特殊设置?我缺少的东西吗?
我们有一个扩展的TestCase(即3.8样式)和纯JUnit 4测试,会是问题这两个测试?

Is there any special setting required for the junit task? Am I missing something? We have both Tests that extends TestCase (i.e. 3.8 style) and "pure" Junit 4 tests, could that be the problem?

推荐答案

我使用纯JUnit4测试使用Ant。

I am using pure JUnit4 tests with Ant.

下面是我的构建文件的有趣的部分:

Here is the interesting part of my build file:

<junit printsummary="yes" haltonfailure="yes">
    <formatter type="xml"/>
    <classpath refid="path.test"/>
    <batchtest fork="yes" todir="${dir.report.unittests.xml}">
        <fileset dir="src">
            <include name="**/*Test*.java"/>
        </fileset>
    </batchtest>
</junit>

请确保您有蚂蚁的lib目录中的最新版本的junit.jar文件。据我所知需要的版本与蚂蚁1.7或更高版本的交付...

Make sure you have the latest version of the junit.jar file in the lib directory of Ant. As far as I know the required version is delivered with ant 1.7 or higher versions...

这篇关于跑步与QUOT;纯QUOT; JUnit 4测试用蚂蚁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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