4
votes

I am trying to run my xUnit unit tests using vstest.console.exe, but no tests are found.

I am using vstest.console.exe from Visual Studio 2015, found in this location:

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

Command run:

vstest.console.exe "C:\MyProject\artifacts\bin\UnitTest\Release\dnx451\UnitTest.dll" /TestAdapterPath:"C:\MyProject\packages"

Response:

Starting test execution, please wait...

Warning: No test is available in the provided sources. Make sure that installed test discoverers & executors, platform & framework version settings are appropriate and try again.

I have also tried with the following TestAdapterPath arguments, but with the same problem:

/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"  

The project.json file:

{
  "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": { }
  }
}

How am I to run these tests?

EDIT: Using the DNX beta6 runtime.

2

2 Answers

3
votes

Run dnx . test on your project

3
votes

You have to point vstest to project.json, and enable UseVsixExtensions flag.

So the actual unit tests run command should like like this: .\vstest.console.exe "..\test\YourProject.Tests\project.json" /UseVsixExtensions:true /logger:trx

My VSO set up looks like this: enter image description here

Reference: Unit Tests with .NET Core and VSTS