Cover和ReportGenerator查看单元测试覆盖率结果

Cover和ReportGenerator查看单元测试覆盖率结果

本文介绍了如何使用OpenCover和ReportGenerator查看单元测试覆盖率结果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于同时使用OpenCover和ReportGenerator来说,我是一个菜鸟,我在理解如何使它们正常工作方面有些挣扎.我正在使用VS.NET 2012'Professional',这意味着我无法使用内置的单元测试覆盖率工具.我还安装了ReSharper,但不想在'dotCover'中购买其他实用程序

I'm a noob to using both OpenCover and ReportGenerator and I'm struggling a bit in understanding how to get them working. I'm using VS.NET 2012 'Professional' which means I don't have access to the built in unit test coverage tooling. I also have ReSharper installed, but don't want to pay for another utility in 'dotCover'

看起来OpenCover和ReportGenerator可以满足我的需要,我看到与文档一起下载的文档,但是缺少一些了解.首先,当我下载两者的nuget软件包时,我的目标项目应该是什么?我有一个多层应用程序,所以我假设我的单元测试项目正确,或者甚至有关系吗?我在文档中看到,我只是指向使用命令行命令的解决方案的/bin(我认为),所以也许我什至不需要将这些下载内容添加到任何特定项目中(可以是一个测试工具) ).有人可以告诉我我是否正确吗?

It looks like OpenCover and ReportGenerator will do what I need and I see the documentation that was downloaded alongside, but am missing some understanding. 1st off, when I download the nuget packges for both, what should my target project be? I have a multi layer app, so I'm assuming my unit test project correct, or does it even matter? I see in the documentation, I'm just pointing at the /bin (I think) of a solution using command line commands, so maybe I didn't even need to add these downloads to any particular project (could have been a test harness). Can someone tell me if I have this correct?

一旦我安装了它们,我将尝试获得单元测试覆盖率指标,并且该软件包随附的文档并不如我所希望的那么清晰.是否有任何好的博客文章或链接可以一起使用这些工具来获取指标?

Once I have them installed, I'm trying to get unit test coverage metrics, and the docs that came with the package are not as clear as I hoped. Are there any good blog posts or links that walk through using these tool together to get the metrics?

推荐答案

您无需将它们添加到特定项目中

you do not need to add these to particular project

我使用报告生成器并打开封面以生成测试覆盖率结果.这是我使用opencover生成代码覆盖范围的脚本

I use report generator and open cover to generate test coverage results too. This is the script I use to generate the codecoverage using opencover

请注意,如果您的参数需要转义引号,即要将带空格的参数传递给该目标进程,则可以使用",例如:-targetargs:"c:\program files"

Note that if your argument needs to escape quotes i.e. to pass arguments with spaces to that target process then you can use ", e.g.: -targetargs:"c:\program files"

这是我用来运行报告生成器的脚本.

This is the script I use to run report generator.

希望这会有所帮助.

这篇关于如何使用OpenCover和ReportGenerator查看单元测试覆盖率结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 10:33