Closed JoyceLiang closed 6 years ago
@JoyceLiang both the .NET Core and .NET Full adapters are getting loaded in test runner (this is most likely same issue as https://github.com/Microsoft/vstest/issues/811). Can you please try latest xunit adapter 2.3.x
?
Thank you @codito, xunit 2.3.0 works for me.
this issue has resurfaced:
I have updated to 2.4.3, I am unable to run any of the discovered tests in xunit, I have changed through all the options for the processor architecture for AnyCPU Projects. I have provided snap shots for all the screens.
here is the package config
here is the diagnostic output unittest.host.21-01-18_12-35-26_57056_1.log
I noticed quite a few file not found errors in regards to the microsoft.testplatform I tried adding the nuget package of the same name. no change.
Visual Studio 2019 enterprise was a fresh install of visual studio after windows 10 reset of the system drive.
By the logs, it seems that some dll from Test Platform are missing. Can you update Microsoft.Net.Test.SDK in your project to latest one and test it? Is it any other log file did you get from \diag option? It should generate two diagnostic log files, if you have please share that one as well.
here is the new log after adding Microsoft.Net.Test.SDK nuget.
unittest.host.21-01-18_17-18-58_00803_1.log packages.config.txt
the log still has these errors: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Diagnostics.NETCore.Client' System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.TestPlatform.TestHostRuntimeProvider' System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.TestPlatform.Extensions.BlameDataCollector'
is there a reason why it is using net 5 when running unit tests for .net 4.5.2?
@kccarter76 That is the problem, dotnet test runs on net 5.0 and you probably do not have it installed. It tries to load these dlls : "C:\Program Files\dotnet\sdk\5.0.102\Extensions\Microsoft.Diagnostics.NETCore.Client.dll", "C:\Program Files\dotnet\sdk\5.0.102\Extensions\Microsoft.TestPlatform.Extensions.BlameDataCollector.dll", "C:\Program Files\dotnet\sdk\5.0.102\Extensions\Microsoft.TestPlatform.Extensions.EventLogCollector.dll", "C:\Program Files\dotnet\sdk\5.0.102\Extensions\Microsoft.TestPlatform.TestHostRuntimeProvider.dll", "C:\Program Files\dotnet\sdk\5.0.102\Extensions\Microsoft.VisualStudio.TestPlatform.Extensions.Html.TestLogger.dll", "C:\Program Files\dotnet\sdk\5.0.102\Extensions\Microsoft.VisualStudio.TestPlatform.Extensions.Trx.TestLogger.dll",
and fails. So install latest net 5.0 and try again.
@Sanan07 I don't think that is the problem. This looks like a more generic problem with the extensions resolving. I see that same assembly errors even on run that passes all tests. And in dotnet versions going back to at least 3.0.301/
Imho this is the actual error: could not find dependent assembly 'Microsoft.AspNet.OData.Test, Version=7.5.4')
TpTrace Information: 0 : 13364, 12, 2021/01/18, 12:35:27.309, 2428221805554, testhost.net452.x86.exe, AssemblyResolver.OnResolve: Resolved assembly: xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, from path: D:\Users\Kenneth.Carter\Documents\WebApi\bin\Debug\UnitTest\AspNet\xunit.abstractions.dll TpTrace Warning: 0 : 13364, 12, 2021/01/18, 12:35:27.554, 2428224251754, testhost.net452.x86.exe, [xUnit.net 00:00:00.35] Skipping: Microsoft.AspNet.OData.Test (could not find dependent assembly 'Microsoft.AspNet.OData.Test, Version=7.5.4') TpTrace Verbose: 0 : 13364, 12, 2021/01/18, 12:35:27.554, 2428224253392, testhost.net452.x86.exe, TestRequestHandler.SendData: sending data from testhost: {"Version":3,"MessageType":"TestSession.Message","Payload":{"MessageLevel":1,"Message":"[xUnit.net 00:00:00.35] Skipping: Microsoft.AspNet.OData.Test (could not find dependent assembly 'Microsoft.AspNet.OData.Test, Version=7.5.4')"}} TpTrace Verbose: 0 : 13364, 3, 2021/01/18, 12:35:27.561, 2428224321486, testhost.net452.x86.exe, BaseRunTests.RunTestInternalWithExecutors: Completed running tests for executor://xunit/VsTestRunner2/net TpTrace Warning: 0 : 13364, 3, 2021/01/18, 12:35:27.563, 2428224335596, testhost.net452.x86.exe, No test is available in D:\Users\Kenneth.Carter\Documents\WebApi\bin\Debug\UnitTest\AspNet\Microsoft.AspNet.OData.Test.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
@kccarter76 please make sure that this assembly will end up in your bin folder. Usually this problem happens when you have a nuget dependency that does not get included in the test project build. And you can usually fix it by installing the appropriate nuget package directly to the test project.
@Sanan07 I have 5.0.102 installed, which is the most current version available.
@nohwnd the file xunit.abstractions.dll is in the bin folder for the AspNet project. it is version 2.0.3 dated 8/25/2018 7:54 pm
Yeah I just realized the dll you are supposed to be missing is the same as your test dll. So either you are referencing the version 7.5.4 of the same-named assembly in your test assembly (can happen when ctrl+dot or alt enter completion goes wrong), or I don't know :D Maybe enabling fusion logs could help? (or this tool https://github.com/awaescher/Fusion)
here is the diag with fusion logging enabled.
unittest.host.21-01-19_10-34-22_07554_1.log
I have traced every file path mentioned and there is a file at the end of each of those paths with the name of the file that is receiving the exception file not found. I have no idea why this happening. I am at point where I wish I could roll back my visual studio to a version that is pre net 5. because, I had earlier iteration with VS 2019 where I could run these unit tests using x64 processor architecture. I think it was 16.4 or 16.5.
Description
.NET Core xunit projects skip all found tests
Steps to reproduce
Expected behavior
Click "Run All" from Text Explorer can run all exist tests.
Actual behavior
Found the test but skip running.
Diagnostic logs
[10/24/2017 10:07:06 AM Informational] ========== Discover test finished: 1 found (0:00:01.3983067) ========== [10/24/2017 10:07:09 AM Informational] ------ Run test started ------ [10/24/2017 10:07:09 AM 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. [10/24/2017 10:07:10 AM Warning] [xUnit.net 00:00:00.0280058] Skipping: XUnitTestProject1 (could not find dependent assembly 'Microsoft.Extensions.DependencyModel, Version=1.1.0') [10/24/2017 10:07:10 AM Warning] No test is available in d:\temp\XUnitTestProject1\XUnitTestProject1\bin\Debug\net462\XUnitTestProject1.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. [10/24/2017 10:07:10 AM Informational] ========== Run test finished: 0 run (0:00:00.6139526) ==========
Environment