关于 Eclipse 的 JUnit 报告
JUnit 与 eclipse 的集成非常好。但是,我希望有一个功能能够从单元测试生成快速报告。在运行无头构建时可以这样做(并且我的夜间构建已配置为这样做),但有时我想从 UI 生成报告。
有办法做到这一点吗?也许是命令行选项?一个额外的插件?也许该功能已经存在但我找不到它?
编辑:我有一个 PDE 版本,因为我的项目是一个 RCP 应用程序。因此,从此构建运行测试并不是非常简单。我想我可以尝试破解一个较小的 ANT 脚本来进行测试,但随后我可能必须与类路径进行斗争才能获得我想要的东西。我希望找到对现有 JUnit 插件的一些扩展,以 HTML 文档的形式提供有关树视图的信息。
The JUnit integration with eclipse is very nice. However, I would like a feature to be able to generate a quick report from the Unit Tests. It is possible to do so when running a headless build (and my nightly build is configured to do so), but sometimes I want to generate a report from the UI.
Is there anyway to do this? command line options maybe? an extra plugin? maybe the functionality is already there and I can't find it?
EDIT: I have a PDE build, as my project is an RCP application. Thus, running the tests from this build is not really straight-forward. I guess I could try to hack a smaller ANT script to do the test, but then probably I have to fight with the classpath to obtain what I want. I was hoping to find some extension to the already existing JUnit plugin that would provide the information on the tree view, but as an HTML document.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用ant并生成HTML报告[我认为您可以在Eclipse中使用Ant]
我找到了这些链接,但您可以调查更多信息:
Ant JUnitReport Task
JUnit 教程
JUint 报告
You can use ant and generate HTML report [I think you can use Ant in Eclipse]
I found these link but you can survey more:
Ant JUnitReport Task
JUnit Tutorial
JUint Report
我不确定您是否想要一份可以分发的“物理”报告,或者只是可以在 IDE 中查看的更多信息。
不管怎样,我同意 SjB 关于配置 Eclipse 以运行 ant 脚本在夜间构建中生成报告的建议。
如果无法在本地运行夜间构建,您可以按照 SjB 答案中的链接进行一些非常简单的构建脚本黑客攻击。
您可能还想查看 Ant JUnit 任务手册页
I'm not sure if you want a "physical" report that you can distribution or just more information you can view in your IDE.
Either way I agree with SjB's advice on configuring Eclipse to run the ant script generating the report in your nightly build.
If it's not possible to run the nightly build locally, you can do some very simple build script hacking following the links in SjB's answer.
You also might want to check out the Ant JUnit Task Manual Page