在 Visual Studio 2013 中生成单元测试报告 [英] Generating Unit Test Reports in Visual Studio 2013

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

问题描述

我在 Visual Studio 2013 的 C# 项目中有一组单元测试.有没有办法根据单元测试结果生成报告?

I have a set of unit tests in a C# project in Visual Studio 2013. Is there a way to generate a report from the unit test results?

我需要一份报告作为测试运行时间和结果的证据.我不是说在线 CI 服务器报告,我只是说本地文件报告.VS2013 有什么好的插件吗?

I need a report as evidence of time when the tests were run and for the results. I dont mean an online CI server report, I just mean a local file report. Are there any nice plugings for VS2013?

我查看了带有 XML 输出的 NUnit 插件,但它不是很准确,显示的很多数据是重复的和不准确的(例如我的操作系统类型).我目前坚持使用 Visual Studio MSTest 测试框架.

I looked into the NUnit plugin with its XML output but its not very accurate, a lot of the data displayed was duplicated and inaccurate (for example my OS type). I'm currently sticking with the Visual Studio MSTest testing framework for now.

推荐答案

我建议使用 vstest.console.exe 从命令行生成结果如下:

I would suggest using vstest.console.exe from the command line to generate the results as follows:

vstest.console.exe YourTestProject.dll/Logger:trx

结果将以以下格式保存:username_PCName YYYY-MM-DD HH_MM_SS.trx" 然后导航到结果已输出的文件夹并使用 trx2html(这是VS2012+的版本)将结果转换成html报告!

The results will be saved in the following format: "username_PCName YYYY-MM-DD HH_MM_SS.trx" Then navigate to the folder where your results have been output and use trx2html (this is the version that works with VS2012+) to convert the results into an html report!

trx2html.exe username_PCName YYYY-MM-DD HH_MM_SS.trx"

我知道你说过你想要一个插件,但也许这会适合你的目的!

I know you said you wanted a plug in, but maybe this will suit your purposes!

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

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