You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to setup a CI/CD pipeline where we reduce the number of builds we do and just run our unit tests agains the built source, potentially on a different machine to the machine that built the dll itself (and almost definitely in a different checkout directory).
/output/tests/unittests is then published as a build artifact
I've also included the dotnet reproducible builds package (and building using TeamCity)
Machine 2 (working directory c:\build{GUID2})
Copy build artifacts to /output/tests/Api.UnitTests
dotnet test output/tests/Api.UnitTests/UnitTests.dll --logger:TeamCity --collect:"XPlat Code Coverage" --ResultsDirectory:output/results/tests -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=cobertura`
The tests run correctly however no coverage is output for them. I did notice that the CoverletSourceRootsMapping is not copied into the output when I do a dotnet publish, I have added a step to manually copy this into the publish directory and I can see the coverage then works, but only if the test coverage is run on the same machine that the build ran on.
What am I missing here, should I give up and just revert back to building everything and running the coverage all together ?
The text was updated successfully, but these errors were encountered:
Hi @danpowell88, coverlet relies on finding the source code files to determine what modules to instrument. Without the source code in the exact same path on the machine running the tests coverlet will consider all the modules to be third-party packages and skip them. #1164 discuss a parameter to give the user control over this, and #1360 implements a variation of that idea to workaround this issue.
So right now you would have to build and execute the tests in one go, but keep an eye on those issues for a fix.
I'm trying to setup a CI/CD pipeline where we reduce the number of builds we do and just run our unit tests agains the built source, potentially on a different machine to the machine that built the dll itself (and almost definitely in a different checkout directory).
So
Machine #1 (working directory c:\build{GUID})
/output/tests/unittests
is then published as a build artifactI've also included the dotnet reproducible builds package (and building using TeamCity)
Machine 2 (working directory c:\build{GUID2})
Copy build artifacts to
/output/tests/Api.UnitTests
The tests run correctly however no coverage is output for them. I did notice that the CoverletSourceRootsMapping is not copied into the output when I do a dotnet publish, I have added a step to manually copy this into the publish directory and I can see the coverage then works, but only if the test coverage is run on the same machine that the build ran on.
What am I missing here, should I give up and just revert back to building everything and running the coverage all together ?
The text was updated successfully, but these errors were encountered: