简体   繁体   English

我可以将cobertura报告导出为Excel文件吗?

[英]Can I export a cobertura report as an excel file?

The higher ups want a report of the unit test coverage. 更高的ups需要一份单元测试覆盖率的报告。 We have cobertura on an ant script. 我们在蚂蚁脚本上有cobertura。 This will generate a big list of html files. 这将生成大量的html文件。 It would be awesome to just run cobertura on a build server for all to see, but we don't have one yet :(. 仅在构建服务器上运行cobertura以供所有人查看将是很棒的事情,但我们还没有一个:(。

My question is, is there an easy way to export the cobertura report into something managers like to read, specifically an excel sheet? 我的问题是,是否有一种简单的方法可以将cobertura报告导出到经理喜欢阅读的东西,特别是Excel工作表?

There isn't an out of the box way to do this. 没有开箱即用的方式来做到这一点。 Your best bet is to run Apache locally and serve the HTML files using the server. 最好的选择是在本地运行Apache并使用服务器提供HTML文件。 You don't need an external build server to do this, you can easily host this on a mac, linux, or windows dev box. 您不需要外部构建服务器即可执行此操作,您可以轻松地将其托管在Mac,Linux或Windows Dev Box上。

Past that, you should really set up a build server if you have a team, do you have source control running somewhere? 除此之外,如果您有团队,那么您应该真正设置构建服务器,您是否在某处运行源代码管理?

I suggest installing Sonar and configuring your build to publish it's code coverage metrics there. 我建议安装Sonar并配置您的构建以在此处发布其代码覆盖率指标。 Lots of other good reasons to run Sonar, it's actually surprisingly easy to setup and integrate. 运行Sonar的其他许多充分理由,实际上非常容易设置和集成。

The following answer explains how to integrate cobertura and Sonar within an ANT build: 以下答案说明了如何在ant构建中集成cobertura和Sonar:

SONAR - Measure Code Coverage using Cobertura SONAR-使用Cobertura测量代码覆盖率

Well, this is sucky... Your only output format choices in Cobertura are XML or HTML. 好吧,这真是令人讨厌。您在Cobertura中唯一的输出格式选择是XML或HTML。

  1. Will an HTML file be okay? HTML文件可以吗? That's very readable, you could print it out for them. 这很容易理解,您可以为他们打印出来。 Maybe even embed it in an email. 甚至可以将其嵌入电子邮件中。

  2. How are you at XSLT? 您好吗? There's an XSLT task in Ant. Ant中有一个XSLT任务。 You can use XSLT to transform your XML file into a comma separated value file that could be read in Excel. 您可以使用XSLT将XML文件转换为可以在Excel中读取的逗号分隔值文件。

The second one isn't that bad. 第二个还不错。 XSLT isn't a hard language to learn, and it shouldn't take too long to translate the file using XSLT. XSLT不是一门难学的语言,使用XSLT转换文件的时间应该不会太长。 I've done this a few times in Ant. 我在Ant中做了几次。 Not enough to actually be good at XSLT, but enough times to know that learning how to do this isn't that bad a deal. 不足以真正擅长XSLT,但有足够的时间知道学习如何做到这一点并不是一件坏事。

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

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