Can't run Xunit tests on Visual Studio 2017

Rostyslav Fedyk picture Rostyslav Fedyk · Mar 27, 2018 · Viewed 11.6k times · Source

Can't run all the XUnit tests on my Visual Studio 2017. Version 15.6.4

They can be viewed in TestExploer and when I run them from there I get something like this:

[27.03.2018 12:21:46 Informational] ------ Load Playlist started ------
[27.03.2018 12:21:46 Informational] ========== Load Playlist finished 
(0:00:00,0215566) ==========
[27.03.2018 12:22:27 Informational] Executing test method 'Lebara.Remittance.Test.ServiceImplementation.RiskEngineServiceTest.ShouldTest'
[27.03.2018 12:22:27 Informational] ------ Run test started ------
[27.03.2018 12:22:29 Warning] 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.
[27.03.2018 12:22:29 Warning] [xUnit.net 00:00:00.0209459] Skipping: 
Lebara.Remittance.Test (could not find dependent assembly 
'Microsoft.Extensions.DependencyModel, Version=1.1.0')
[27.03.2018 12:22:29 Warning] No test is available in C:\ReposNew\Lebara.Remittance\Lebara.Remittance\Lebara.Remittance.Test\bin\Debug\Lebara.Remittance.Test.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
[27.03.2018 12:22:29 Informational] ========== Run test finished: 0 run 
(0:00:02,1543479) ==========
[27.03.2018 12:34:19 Informational] Executing test method 'Lebara.Remittance.Test.ServiceImplementation.RiskEngineServiceTest.ShouldTest'
[27.03.2018 12:34:19 Informational] ------ Run test started ------
[27.03.2018 12:34:20 Warning] 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.
[27.03.2018 12:34:20 Warning] [xUnit.net 00:00:00.0200861] Skipping: 
Lebara.Remittance.Test (could not find dependent assembly 
'Microsoft.Extensions.DependencyModel, Version=1.1.0')
[27.03.2018 12:34:20 Warning] No test is available in C:\ReposNew\Lebara.Remittance\Lebara.Remittance\Lebara.Remittance.Test\bin\Debug\Lebara.Remittance.Test.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
[27.03.2018 12:34:20 Informational] ========== Run test finished: 0 run 
(0:00:00,7088116) ==========

I tried deleting %TEMP%\VisualStudioTestExplorerExtensions - nothing helped.

The thing is, several days ago I could run them. I did not change a thing. Just have no idea what is going on.

Also I had this warning

 [27.03.2018 12:22:29 Warning] 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.
 [27.03.2018 12:22:29 Warning] [xUnit.net 00:00:00.0209459] Skipping: 
 Lebara.Remittance.Test (could not find dependent assembly 
 'Microsoft.Extensions.DependencyModel, Version=1.1.0')

Answer

FrankyHollywood picture FrankyHollywood · Oct 9, 2018

I had problems with xUnit. Some important things:

1) Make sure the "Microsoft Visual Studio Test Platform" extension is enabled

2) Make sure "Test => Test Settings => Default Processor Architecture" matches your build.

3) Install nuget package 'xunit.runner.visualstudio'