gpt4 book ai didi

ant - 使用 ant 运行 "pure"JUnit 4 测试

转载 作者:行者123 更新时间:2023-12-03 11:26:59 24 4
gpt4 key购买 nike

我们已经迁移到 JUnit 4 和 ant 1.7

测试在 Eclipse 中运行良好,但在使用 ant 运行测试时会忽略注释。

根据Ant junit任务documentation :

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



但是文档没有详细说明它应该如何配置。

junit 任务是否需要特殊设置?我错过了什么吗?
我们有扩展 TestCase(即 3.8 样式)的测试和“纯”Junit 4 测试,这可能是问题吗?

最佳答案

我正在使用 Ant 的纯 JUnit4 测试。

这是我的构建文件中有趣的部分:

<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>

确保您在 Ant 的 lib 目录中有最新版本的 junit.jar 文件。据我所知所需的版本是随 ant 1.7 或更高版本一起提供的...

关于ant - 使用 ant 运行 "pure"JUnit 4 测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/635481/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com