使用 vstest 运行 xUnit 测试

Dav*_*New 5 xunit vstest visual-studio-2015 dnx asp.net-core

我正在尝试使用运行我的 xUnit 单元测试vstest.console.exe,但未找到任何测试。

我使用的vstest.console.exe是 Visual Studio 2015,可以在以下位置找到:

C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\ Microsoft\TestWindow

命令运行:

vstest.console.exe "C:\MyProject\artifacts\bin\UnitTest\Release\dnx451\UnitTest.dll" /TestAdapterPath:"C:\MyProject\packages"
Run Code Online (Sandbox Code Playgroud)

回复:

正在开始测试执行,请稍候...

警告:所提供的来源中没有可用的测试。确保已安装的测试发现器和执行器、平台和框架版本设置合适,然后重试。

我还尝试使用以下 TestAdapterPath 参数,但遇到同样的问题:

/TestAdapterPath:"C:\MyProject\packages\xunit.runner.visualstudio"

/TestAdapterPath:"C:\MyProject\packages\xunit.runner.visualstudio\2.1.0-beta4-build1109"

/TestAdapterPath:"C:\MyProject\packages\xunit.runner.visualstudio\2.1.0-beta4-build1109\build" 

/TestAdapterPath:"C:\MyProject\packages\xunit.runner.visualstudio\2.1.0-beta4-build1109\build\_common"  
Run Code Online (Sandbox Code Playgroud)

文件project.json:

{
  "dependencies": {
    "xunit": "2.1.0-beta4-build3109",
    "xunit.runner.dnx": "2.1.0-beta4-build134",
    "xunit.runner.visualstudio": "2.1.0-beta4-build1109"
  },
  "commands": {
    "test": "xunit.runner.dnx"
  },
  "frameworks": {
    "dnx451": { }
  }
}
Run Code Online (Sandbox Code Playgroud)

我该如何运行这些测试?

编辑:使用 DNX beta6 运行时。

Vic*_*aci 3

dnx . test在您的项目上运行