如何将 NUnit 输出转换为 HTML 报告

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2996219/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 03:21:59  来源:igfitidea点击:

How to convert NUnit output into an HTML report

htmlformattingnunit

提问by Grhm

Does anyone have any suggestions for a good tool, xslt or other that can produce an HTML report from the XML output of NUnit?

有没有人对 xslt 或其他可以从 NUnit 的 XML 输出生成 HTML 报告的好工具有任何建议?

We're currently using NUnit 2.5.5 to run a number of tests on our code base. The dev team are happy seeing the output in the GUI and console runners and the report shown on our Hudson server.

我们目前正在使用 NUnit 2.5.5 在我们的代码库上运行一些测试。开发团队很高兴看到 GUI 和控制台运行程序中的输出以及 Hudson 服务器上显示的报告。

The Hudson generated report needs a user to click links to drill down to some of the details. I would like to produce a single document report suitable for showing to management and/or the client.

Hudson 生成的报告需要用户单击链接以深入了解某些详细信息。我想制作一份适合向管理层和/或客户展示的单一文件报告。

Thus far, the only tool I've found is http://nunit2report.sourceforge.net/which hasn't been updated sine 2003, is based on an old version of NUnit (I think the report format might have changed significantly?) and is a nant task (we don't use nant).

到目前为止,我发现的唯一工具是http://nunit2report.sourceforge.net/,它在 2003 年之后没有更新,它基于旧版本的 NUnit(我认为报告格式可能已经发生了重大变化?)并且是一个 nant 任务(我们不使用 nant)。

Before I spend too long trying to doctor nunit2reports xslt's to suit the recent NUnit's output, can anyone point be to a more suitable tool?

在我花太长时间尝试修改 nunit2reports xslt 以适应最近的 NUnit 输出之前,有人可以指出更合适的工具吗?

Many thanks.

非常感谢。

采纳答案by Grhm

For anyone interested, I found two other tools.

对于任何感兴趣的人,我找到了另外两个工具。

Both are available on Lauchpad, linked to from the very basic product pages linked above.

两者都可以在 Lauchpad 上找到,链接到上面链接的非常基本的产品页面。

Unfortunately, neither of these tools provided the required level of detail for our installation - so I ended up doctoring the xslt's that came with nunit2reportto suit out needs.

不幸的是,这些工具都没有为我们的安装提供所需的详细程度 - 所以我最终修改了nunit2report附带的 xslt以满足需求。

回答by Luke

I know this is an old question, but it's the top result in Google on the subject and thought it deserved a mention.. Where I work had the exact same issue so we developed a little app that will parse an XML results file and output a nice looking self-contained HTML page based on bootstrap 3. Code and binaries are available on GitHub. It's responsive as well as we email the reports to mobile devices.

我知道这是一个老问题,但它是谷歌在这个主题上的最高结果,并认为它值得一提。我工作的地方有完全相同的问题,所以我们开发了一个小应用程序来解析 XML 结果文件并输出一个基于 bootstrap 3 的漂亮的自包含 HTML 页面。代码和二进制文件可在 GitHub 上找到。它响应迅速,我们将报告通过电子邮件发送到移动设备。

回答by Anshoo

ReportUnit is not maintained and is being replaced by extentreports-dotnet-cli.

ReportUnit 没有维护,正在被extentreports-dotnet-cli取代。



You can also try ReportUnit, which also supports Gallio, xUnit, TestNG and MSTest: http://reportunit.relevantcodes.com

你也可以试试 ReportUnit,它也支持 Gallio、xUnit、TestNG 和 MSTest:http://reportunit.relevantcodes.com

This is a simple exe file that will convert your xml report into an HTML dashboards (samples):

这是一个简单的 exe 文件,它将您的 xml 报告转换为 HTML 仪表板(示例):

Usage:

用法:

reportunit "path-to-folder" // folder-level report
reportunit "path-to-folder" "output-folder" // folder-level report
reportunit "Result.xml" "generated.html" // file-level report

More info here: http://reportunit.relevantcodes.com

更多信息在这里:http: //reportunit.relevantcodes.com

回答by Eternal21

This looks decent, works with NUnit3, is free and actively maintained as of Sept 2017: https://ghpreporter.github.io/

这看起来不错,可与 NUnit3 一起使用,自 2017 年 9 月起免费且积极维护:https://ghpreporter.github.io/

Github: https://github.com/GHPReporter/Ghpr.Core

Github:https: //github.com/GHPReporter/Ghpr.Core

Sample Report: http://ghpreporter.github.io/report/?currentTab=runs-stats

示例报告:http: //ghpreporter.github.io/report/?currentTab=runs-stats

回答by Peter Bernier

There's also an 'nunit2report' task in NAntContrib (which was recently updated with the NAnt 0.91 release).

在 NAntContrib(最近随着 NAnt 0.91 版本更新)中还有一个“nunit2report”任务。

NAntContrib NUnit2Report Task

NAntContrib NUnit2Report 任务