Visual Studio 2012代码覆盖率 [英] Visual Studio 2012 Code Coverage

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

问题描述

我们有一个非常复杂的基于Web的产品,包括大量的Web服务等。
我正在尝试使用VS 2012命令行实用程序vstest.console.exe收集产品中所有程序集的代码覆盖率。收集单元测试的代码覆盖范围非常容易,但是,没有标志或开关表明我可以将进程附加到IIS或收集Web服务(客户端和服务器端)的信息。

We have very complex web based product including solid number of web services etc. I'm trying to collect code coverage for all assemblies in our product using VS 2012 command line utility vstest.console.exe. It is pretty easy to collect code coverage for Unit Tests, however, there is no flag or switch that indicates that I can attach the process to IIS or collect info for web services (both client and server sides).

有什么建议吗?

推荐答案

使用 Microsoft测试管理器(MTM)从IIS应用程序收集代码覆盖率的详细说明您可以在以下博客中找到strong> Visual Studio 2012 Update 1 : http://blogs.msdn.com/b/visualstudioalm/archive/2012/11/28/code-coverage-in-microsoft- test-manager-in-visual-studio-update-1.aspx

Detailed instructions for collecting code coverage from IIS applications using Microsoft Test Manager(MTM) of Visual Studio 2012 Update 1 can be found in this blog: http://blogs.msdn.com/b/visualstudioalm/archive/2012/11/28/code-coverage-in-microsoft-test-manager-in-visual-studio-update-1.aspx

以下是摘要:


  • 安装 VS Update 1

  • 将Microsoft Test Manager(MTM)连接到团队项目(Team Foundation Server)并设置测试计划等。您可以在团队基础服务以创建团队项目。

  • 使用代码Coverag创建测试设置启用了数据收集器。

  • 使用此测试设置运行手动测试或探索性测试。

  • 您将在最后获得代码覆盖文件

  • Install VS Update 1.
  • Connect Microsoft Test Manager(MTM) to a Team Project (Team Foundation Server) and setup test plan etc. You can utilize the free account in Team Foundation Service to create team project.
  • Create a test settings with code coverage data collector enabled.
  • Run a manual test or an exploratory test with this test settings.
  • You will get the code coverage file at the end of the test run.

替代解决方案:


  • 使用 CodeCoverage.exe 收集代码覆盖率。路径:C:\Program Files(x86)\Microsoft Visual Studio 11.0\团队工具\动态代码覆盖率工具\CodeCoverage.exe。您不需要安装更新1,但我建议您这样做。示例:

  • Use CodeCoverage.exe to collect code coverage. Path: C:\Program Files (x86)\Microsoft Visual Studio 11.0\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe. You don't need update 1 to be installed, but I recommend that you do so. Example:

CodeCoverage collect / IIS / session:WebSession /output:MyWebApp.coverage

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

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