简体   繁体   English

关于Eclipse的JUnit报告

[英]JUnit report on Eclipse

The JUnit integration with eclipse is very nice. JUnit与eclipse的集成非常好。 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. 运行无头构建时可以这样做(我的夜间构建配置为这样做),但有时我想从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. 编辑:我有一个PDE构建,因为我的项目是一个RCP应用程序。 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. 我想我可以尝试破解一个较小的ANT脚本来进行测试,但是我可能不得不与类路径争夺以获得我想要的东西。 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. 我希望找到一些已经存在的JUnit插件的扩展,它将提供有关树视图的信息,但是作为HTML文档。

You can use ant and generate HTML report [I think you can use Ant in Eclipse] 你可以使用ant并生成HTML报告[我认为你可以在Eclipse中使用Ant]
I found these link but you can survey more: 我找到了这些链接但你可以调查更多:

Ant JUnitReport Task Ant JUnitReport任务
JUnit Tutorial JUnit教程
JUint Report JUint报告

I'm not sure if you want a "physical" report that you can distribution or just more information you can view in your IDE. 我不确定您是否需要可以分发的“物理”报告或者您可以在IDE中查看的更多信息。

Either way I agree with SjB's advice on configuring Eclipse to run the ant script generating the report in your nightly build. 无论哪种方式,我都同意SjB关于配置Eclipse以运行在每晚构建中生成报告的ant脚本的建议。

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. 如果无法在本地运行每晚构建,您可以按照SjB答案中的链接执行一些非常简单的构建脚本黑客攻击。

You also might want to check out the Ant JUnit Task Manual Page 您还可以查看Ant JUnit任务手册页

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM