Visual Studio 2012代码覆盖率

编程入门 行业动态 更新时间:2024-10-27 23:27:37
本文介绍了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 : blogs.msdn/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: blogs.msdn/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代码覆盖率

本文发布于:2023-11-14 10:42:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1587001.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:覆盖率   代码   Visual   Studio

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!