MSTest的代码覆盖 [英] MSTest Code Coverage

查看:951
本文介绍了MSTest的代码覆盖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法到Visual Studio中测试的代码覆盖率,如果我使用MSTest的?或者我有买NCover?

Is there a way to test code coverage within visual studio if I'm using MSTest? Or do I have to buy NCover?

是NCover企业值得的钱或者旧的贝塔值足够好,如果微软不提供内置的工具来进行代码覆盖率?

Is the NCover Enterprise worth the money or are the old betas good enough if Microsoft doesn't provide built in tools to do code coverage?

编辑:VS产品,哪些包含代码覆盖率
说明http://www.microsoft.com/visualstudio/en-us/products /teamsystem/default.mspx\">http://www.microsoft.com/visualstudio/en-us/products/teamsystem/default.mspx

Description of VS Products and which ones include code coverage http://www.microsoft.com/visualstudio/en-us/products/teamsystem/default.mspx

TestDriven.NET( http://testdriven.net/ )可以使用,如果你的VS版本不支持它。

TestDriven.NET (http://testdriven.net/) can be used if your VS version doesn't support it.

推荐答案

是的,你可以从Visual Studio中找到的代码覆盖率信息,前提是你有一个版本的Visual Studio提供该功能,如组队系统。
当设置在VS.NET单元测试,一个localtestrun.testrunco​​nfig文件将被创建并添加作为解决方案的一部分。双击该文件,并找到在对话框左侧的选项代码覆盖选项。选择您要收集代码覆盖率信息,然后将组件重新运行单元测试。代码覆盖率信息将被收集并可用。要获得代码覆盖率信息打开测试结果窗口,然后单击代码覆盖率结果按钮,将打开的结果替代的窗口。

Yes, you can find code coverage information from within Visual Studio, provided that you have a version of Visual Studio that provides that functionality, such as the Team System. When setting up the unit tests in VS.NET, a localtestrun.testrunconfig file will be created and added as part of the solution. Double-click this file and find the option Code Coverage option on the left of the dialog. Select the assemblies for which you want to collect code coverage information and then re-run the unit tests. Code coverage information will be collected and is available. To get the code coverage information open the test results window and click on the code coverage results button, which will open an alternative window with the results.

这篇关于MSTest的代码覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆