spekt / junit.testlogger

JUnit test logger for vstest platform (<= v3.x)
MIT License
77 stars 15 forks source link

test with vstest.console.exe #65

Closed Groostav closed 10 months ago

Groostav commented 1 year ago

Hey Guys,

I'm trying to get this working with vstest.console.exe and some VC++ MSTest tests. I believe this is a delegate chosen by dotnet test.

I've tried playing with /TestAdapterPath and /TestAdapterLoadingStrategy, but I just cant seem to get your dotnet assembly's on the PATH sufficiently for this executable.

The best I;ve been able to get is

vstest.console /TestAdapterPath:C:\Users\geoff\Code\HelloStaticLib\JunitXml-TestLogger-3.0.124 /ResultsDirectory:vs-test-results /Logger:junit ./x64/Debug/HelloStaticLibTests.dll

to produce

Could not find a test logger with AssemblyQualifiedName, URI or FriendlyName 'junit'.

Is dotnet test simply entirely different from vstest.console.exe and thus my usage simply isnt supported?

codito commented 1 year ago

@Groostav dotnet test uses vstest console internally. However assembly resolution may be slightly different. Can you please share the logs by running with vstest.console --diag:log.txt?

EDIT: adding some more notes on internals in case it helps diagnose the issue.

  1. log.txt file will explicitly show the traces of which paths are looked up and which dlls are candidates for loggers.
  2. I'm assuming C:\Users\geoff\Code\HelloStaticLib\JunitXml-TestLogger-3.0.124 is the extracted nupkg file. If so, try this path instead C:\Users\geoff\Code\HelloStaticLib\JunitXml-TestLogger-3.0.124\build\_common
  3. Ideally this logger is expected to be included as a PackageReference in the csproj. Internally, it includes msbuild props which copy the dlls from build\_common to the test project's Output directory. This makes it easier for dotnet test to discover the logger dll.
codito commented 10 months ago

Closing due to inactivity.