的Visual Studio 2012单元测试报告 [英] Visual Studio 2012 Unit Test Report

查看:318
本文介绍了的Visual Studio 2012单元测试报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建我的单元测试用例执行的一些报告(测试通过,数量失败,忽略)。我看了看周围的互联网,但我没有找到任何方式来产生这一点。是否有人知道一个简单的(或复杂)的方式来本地生成单元测试报告? (我在当地说,因为我发现使用测试管理器解决方案,但并不可行我右击了)。

I need to create some report of the execution of my unit test cases (quantity of tests passed, failed and ignored). I looked around the internet but I didn't find any way to generate this. Does someone knows a simple (or complex) way to generate a unit test report locally? (I said locally because I have found a solution using the test manager but is not feasible to me righ now).

推荐答案

有是没有从Visual Studio用户界面选项,BTU这可以从comamndline来完成。浏览到您的解决方案目录并运行从Visual Studio 2013的命令行下面的命令:

There is no option from the Visual Studio UI, btu this can be accomplished from the comamndline. navigate to your solution directory and run the following command from the Visual Studio 2013 commandline:

vstest.console.exe /记录器:TRX .\\ \\TestProject\bin\debug\YourUnitTestAssembly.dll

vstest.console.exe /logger:trx .\TestProject\bin\debug\YourUnitTestAssembly.dll

这将创建您的解决方案根目录下TestResults文件夹拖放。 TRX文件。通过打开该文件到Visual Studio,你应该看到这样的内容:

This will create a TestResults folder under your solution root and drop a .trx file. By opening that file into Visual Studio you should see something like this:

在这里输入的图像描述

的带有.trx文件是容易解析XML和可转换成可读的数据的using~~V的XSLT,在此的其他问题解释说。

The .trx file is easy to parse XML and can be converted into human readable data using an XSLT, as explained in this other question.

通常情况下Visual Studio中的运行过程中创建此文件,但后来删除它。它看起来像我的Visual Studio实例实际上将创建一个这样的TRX文件,并保持在一个 $(solutionroot)\TestResults\ {GUID} 目录时,我用的是分析代码覆盖功能:

Normally Visual Studio creates this file during the run, but deletes it afterwards. It looks like my instance of Visual Studio will actually create such a trx file and keep it in a $(solutionroot)\TestResults\{GUID} directory when I use the Analyze code coverage feature:

要看看你的Visual Studio版本安装了事务处理记录仪,运行Visual Studio命令提示符下键入以下命令:

To see if your version of Visual studio has the Trx logger installed, run the following command from a Visual Studio command prompt:

这篇关于的Visual Studio 2012单元测试报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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