Apache Ant 1.10.10 大约在一个月前发布了,在通常的错误修复中,为 “junitlauncher “任务增加了一个新的改进。
对于那些没有使用过或不了解 “junitlauncher “任务的人来说,它是我们几年前引入的一个新任务,目的是让使用Ant的项目能够使用新的JUnit5测试框架。以前的(仍然支持的)”junit “任务是为了在你想继续只使用JUnit4时使用。如果你计划使用JUnit5(它也支持JUnit4风格的测试案例),那么你将不得不使用 “junitlauncher “任务。
这个 “junitlauncher “任务已经存在了几年,一些用户报告说它的 “printSummary “功能没有什么用。熟悉 “junit “任务的人都知道,当一个测试被运行时,该任务会打印出一个即时的摘要,比如。
Running org.myapp.foo.bar.SimpleTest Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 sec
复制代码
这对于查看正在运行的测试的快速摘要很有用。
junitlauncher “有一个 “printSummary “属性,直到Ant 1.10.10版本都是在所有测试执行完毕后打印一个摘要。此外,打印的摘要是JUnit5框架默认生成的摘要,类似于。
[junitlauncher]
[junitlauncher] Test run finished after 5103 ms
[junitlauncher] [ 2 containers found ]
[junitlauncher] [ 0 containers skipped ]
[junitlauncher] [ 2 containers started ]
[junitlauncher] [ 0 containers aborted ]
[junitlauncher] [ 2 containers successful ]
[junitlauncher] [ 0 containers failed ]
[junitlauncher] [ 1 tests found ]
[junitlauncher] [ 0 tests skipped ]
[junitlauncher] [ 1 tests started ]
[junitlauncher] [ 0 tests aborted ]
[junitlauncher] [ 1 tests successful ]
[junitlauncher] [ 0 tests failed ]
复制代码
正如你所看到的,这种形式的总结并不真正有用。因此,一些Ant用户要求(https://bz.apache.org/bugzilla/show_bug.cgi?id=64836)对此进行改进,以提供一个类似于我们的 “junit “任务的总结。
这个Ant 1.10.10版本现在包括这个改进。当你在 “junitlauncher “任务上使用 “printSummary=true “时,它现在会像 “junit “任务那样,打印出一个更有用、更直接的总结。
Running org.myapp.foo.bar.SimpleTest Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 sec
复制代码
像往常一样,该版本可在Ant下载页面ant.apache.org/bindownload…。请试一试,如果你对这个版本有任何建议或反馈,请在我们的邮件列表ant.apache.org/mail.html或我们的问题跟踪ant.apache.org/bugs.html 与我们联系。