Xunit Unit Tests will not work

I am completely stuck on this issue. So my team has a unit test project in a service testing project. Tests are detected in the test explorer panel, however, when I try to run the tests, I get the following errors:

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

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

'In C: \ there is no test. Make sure that the test discoverer and performers are registered, and that the platform and wireframe 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" } } } 

It is strange that it works for my team members. But not me. Differences in our environment: the latest update from Windows and Visual Studio, while this update or two is behind.

Does anyone know of a workaround?

+5
source share
3 answers

I had the same problem and fixed it by updating Visual Studio 2017 from 15.5.2 to 15.5.4 and updating the links to my test projects:

 <ItemGroup> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0-preview-20170628-02" /> <PackageReference Include="xunit" Version="2.2.0" /> <PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" /> </ItemGroup> 

in

 <ItemGroup> <PackageReference Include="xunit" Version="2.3.1" /> <PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" /> </ItemGroup> 

And restarting Visual Studio (apparently VS caches and uses the previous version even after you updated).

Not sure if one of three things or a combination of them fixed it.

+2
source

I ran into the same problem, but I already have Visual Studio 2017 15.5.4 installed. To make it work, I updated all the xunit related links and now my respective .csproj links look like this:

 <ItemGroup> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" /> <PackageReference Include="xunit" Version="2.3.1" /> <PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" /> </ItemGroup> 

Not sure what doesn't work, but my advice is to make sure this link is within csproj and has these minimum versions.

+1
source

Installing the package "xunit.runner.visualstudio" did the trick for me. Prior to that, he had not worked with frame 462.

0
source

Source: https://habr.com/ru/post/1274204/


All Articles