Xunit Unit Tests will not run

CMR picture CMR · Dec 19, 2017 · Viewed 22.6k times · Source

I am completely stuck on this issue. So my team has a unit test project in a services test project. The tests are discovered in the test explorer pane however when I try and run the tests I get these errors:

'Multiple test adapters with the same uri 'executor://xunit/VsTestRunner2' were found. Ignoring adapter 'Xunit.Runner.VisualStudio.TestAdapter.VsTestRunner'. Please uninstall the conflicting adapter(s) to avoid this warning'

'[xUnit.net 00:00:00.0251250] Skipping: (could not find dependent assembly 'Microsoft.Extensions.DependencyModel, Version=1.1.0')'

'No test is available in C:\. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.'

Context information:

  • Xunit 2.2.0
  • Visual Studio 15.5.2
  • Windows 10 1709 Build: 16299.125

My Test Projects project.json:

{
   "version": "1.0.0-*",
   "testRunner": "xunit",
    "dependencies": {
       "dotnet-test-xunit": "2.2.0-preview2-build1029",
       "Microsoft.AspNetCore.Mvc.ViewFeatures": "1.1.3",
       "Microsoft.DiaSymReader": "1.0.8",
       "Microsoft.DiaSymReader.Native": "1.4.1",
       "Microsoft.Extensions.Logging.Abstractions": "1.1.2",
       "Microsoft.Extensions.Testing.Abstractions": "1.0.0-preview2-003121",
       "Newtonsoft.Json": "9.0.1",
       "WebServices": "1.0.0-*",
       "xunit": "2.2.0",
       "xunit.abstractions": "2.0.1",
       "xunit.assert": "2.2.0",
       "xunit.core": "2.2.0",
       "xunit.extensibility.core": "2.2.0",
       "xunit.extensibility.execution": "2.2.0",
       "xunit.runner.utility": "2.2.0"
   },
   "frameworks": {
    "net461": {
        "dependencies": {
            "Microsoft.NETCore.Platforms": "1.1.0"
        }
    }
}

The Weird thing is that it works for my team members. But not me. The differences in our environments are: the latest update from Windows and Visual Studio, while they are an update or two behind.

Does anyone know of a workaround?

Answer

Pravin picture Pravin · Mar 28, 2018

Installing or updating "xunit.runner.visualstudio" package did the trick for me. Until that, it was not working with framework 462.