spekt / xunit.testlogger

XUnit logger for vstest platform
MIT License
73 stars 15 forks source link

Error "Could not find a test logger with AssemblyQualifiedName, URI or FriendlyName 'xunit'." #37

Closed slavapr closed 2 years ago

slavapr commented 2 years ago

Hey guys,

Recently, we have updated to XunitXml.TestLogger from 2.1.45 to 3.0.66 and JunitXml.TestLogger to 3.0.98. And if we run "dotnet test -c Release --logger:xunit" such error occurs "Could not find a test logger with AssemblyQualifiedName, URI or FriendlyName 'xunit'.".

Interesting things that if we roll back XunitXml.TestLogger to 2.1.45 or remove JunitXml.TestLogger everything works.

Test project with the error. ConsoleAppXUnitTestLogger.zip

codito commented 2 years ago

@slavapr thanks for reporting this issue. We've released v3.0.70 with a fix. It should be available on nuget.org shortly.

carlin-q-scott commented 9 months ago

I'm having this issue with dotnet CLI 7.0.306. It has no issue using trx report logger, but it gives the exact same error as in this issue using xunit.testlogger v3.1.11 or v2.1.45. I tried both because I'm using xunit v2.4.2.

codito commented 9 months ago

@carlin-q-scott could you please share the diagnostics log*.txt files created using dotnet test --diag:log.txt for us to investigate?

Please feel free to create a new issue.

carlin-q-scott commented 9 months ago

@codito Here's the log file you requested: log.txt

I didn't see it attempting to load the xunit logger dll. So that's probably the issue.

codito commented 9 months ago

@carlin-q-scott yes, that's the issue.

Here's the expected behavior: dotnet test should find the xunit logger dll from redacted\source\repos\redacted\tests\redacted.FormulaPlugin.UnitTests\bin\Debug\net7.0\. These dlls are copied from XunitXmlLogger nuget package to the build output directory during build time.

What's the dotnet test command line you're using? Could we check the directory mentioned above if it has the xunit dlls? Does the redacted.FormulaPlugin.UnitTests correctly refer Xunit logger nuget package?

Is it possible to create a shareable minimal repro project for this to debug further?


log.txt

Here are the relevant logs from a sample xunit test created with dotnet new xunit to compare.

TpTrace Verbose: 0 : 11927, 1, 2023/08/15, 07:55:55.720, 1070833899265, vstest.console.dll, TestPluginCache: Update extensions started. Skip filter = False
TpTrace Verbose: 0 : 11927, 1, 2023/08/15, 07:55:55.720, 1070833960662, vstest.console.dll, TestPluginCache: Using directories for assembly resolution '/tmp/trial/bin/Debug/net7.0,/home/arun/.nuget/packages/coverlet.collector/3.1.2/build/netstandard1.0'.
TpTrace Verbose: 0 : 11927, 1, 2023/08/15, 07:55:55.720, 1070833986051, vstest.console.dll, TestPluginCache: Updated the available extensions to '/tmp/trial/bin/Debug/net7.0/Microsoft.VisualStudio.TestPlatform.Extension.Xunit.Xml.TestLogger.dll,/tmp/trial/bin/Debug/net7.0/Spekt.TestLogger.dll,/home/arun/.nuget/packages/coverlet.collector/3.1.2/build/netstandard1.0/coverlet.collector.dll'.
carlin-q-scott commented 9 months ago

I ran this from the project folder:

dotnet test --diag:log.txt --logger xunit

Comparing our test logs, I notice that mine did not scan the project bin:

Using directories for assembly resolution 'redacted.nuget\packages\coverlet.collector\6.0.0\build\netstandard1.0'.

From noticing that, I figured out a workaround for this issue:

dotnet test --logger xunit --test-adapter-path .\bin\Debug\net472

I wonder if this is a bug in the dotnet test runner when working with .NET Framework tests.

codito commented 9 months ago

@carlin-q-scott good find! We can create an issue or discussion in https://github.com/Microsoft/vstest to learn more about this behavior.