如何使用 VS2015 预览版运行 xUnit 单元测试? [英] How can I run xUnit Unit Tests with VS2015 Preview?

查看:50
本文介绍了如何使用 VS2015 预览版运行 xUnit 单元测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过扩展管理器添加了xUnit.net runner for Visual Studio"v0.99.8,但是当我打开测试资源管理器窗口时,它似乎没有选择我的任何单元测试.此外,Resharper 9 EAP 是唯一支持 VS2015 的 Resharper 版本,似乎还没有 xUnit Test Runner 插件.

I added the "xUnit.net runner for Visual Studio" v0.99.8 via Extensions Manager, but when I open the Test Explorer window, it does not seem to pick up any of my unit tests. Also, the Resharper 9 EAP does which is the only version of Resharper that supports VS2015 does seem yet to have the plugin for xUnit Test Runner.

那么,我如何才能在 VS2015 预览版中运行 xUnit 单元测试?

How then, can I run xUnit Unit Tests in VS2015 Preview?

推荐答案

您可以在这里找到答案:http://blogs.msdn.com/b/webdev/archive/2014/11/12/annoucing-asp-net-features-in-visual-studio-2015-preview-and-vs2013-update-4.aspx

You can find the answer here: http://blogs.msdn.com/b/webdev/archive/2014/11/12/announcing-asp-net-features-in-visual-studio-2015-preview-and-vs2013-update-4.aspx

Visual Studio 支持通过测试资源管理器运行和调试 ASP.NET 5 xUnit 测试.您需要做的就是将 xUnit 依赖项和测试命令添加到测试项目的 project.json 文件中,如下所示(注意:要安装 xUnit 包,您需要添加 https://www.myget.org/F/aspnetvnext/api/v2 作为 NuGet 包源):

Visual Studio supports running and debugging for ASP.NET 5 xUnit tests through test explorer. All you need to do is add the xUnit dependencies and test commands to the test project's project.json file, as shown below (NOTE: To install the xUnit packages you will need to add https://www.myget.org/F/aspnetvnext/api/v2 as a NuGet package source):

"dependencies": {
    "Xunit.KRunner": "1.0.0-beta1"
},

"commands": {
    "test": "Xunit.KRunner"
},

<小时>

如果有人问如何添加 https://www.myget.org/F/aspnetvnext/api/v2 作为 NuGet 包源...以下是步骤:


If anyone is asking how to add https://www.myget.org/F/aspnetvnext/api/v2 as a NuGet package source... here are the steps:

  1. 在 Visual Studio 2015 预览版中,转到工具 -> 选项 -> NuGet 包管理器 -> 包源
  2. 点击顶部的加号(添加)按钮(见下图)
  3. 输入名称和来源,如下图所示(注意:输入名称和来源后,请务必单击更新按钮)

快乐编码!

这篇关于如何使用 VS2015 预览版运行 xUnit 单元测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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