Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JUnit results file missing on MacOS when code coverage collector is used #72

Closed
ablok opened this issue Feb 6, 2024 · 5 comments
Closed
Assignees

Comments

@ablok
Copy link

ablok commented Feb 6, 2024

When running a dotnet test command using --logger "jUnit", a TestResults.xml file will be created. However, when adding the --collect "Code Coverage" option, the TestResults.xml file will no longer be created. This happes on MacOS. On Windows the file will be created as expected.

I created a sample project here: https://github.com/ablok/JunitLoggerExample

@codito
Copy link
Contributor

codito commented Feb 8, 2024

@ablok I don't have access to a MacOS box. I can validate that TestResults.xml is created on Linux.

Would it be possible to share a trace log? https://github.com/microsoft/vstest/blob/main/docs/diagnose.md#collect-traces-using-command-line

@ablok
Copy link
Author

ablok commented Feb 9, 2024

@codito here is the output from the dotnet test command while adding the --diag:log.txt option.

log.datacollector.24-02-09_13-09-43_24858_5.txt
log.host.24-02-09_13-09-44_80011_5.txt
log.txt

@codito
Copy link
Contributor

codito commented Feb 9, 2024

Thanks @ablok, the logs helped! I think we need to apply a fix to exclude all Spekt* assemblies from code coverage, the Code Coverage instrumentation is messing up test result callbacks and hence we never get a call back to save the run results.

Workaround
test.runsettings.txt

  • Copy above file as test.runsettings
  • Try this command:
    dotnet test Example.sln --results-directory "./output" --logger "jUnit" --collect "Code Coverage" --settings test.runsettings

@ablok
Copy link
Author

ablok commented Feb 9, 2024

@codito the workaround indeed works.

@codito
Copy link
Contributor

codito commented Feb 10, 2024

@codito codito closed this as completed Feb 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants