DEV Community

Discussion on: Coverlet, unit tests coverage for .NET

Collapse
 
fabasoad profile image
Yevhen Fabizhevskyi

Thanks for this article. Trying to connect coverlet test coverage to my CI pipeline now but didn't get how to collect total test coverage. I have 3 test projects, like Project1.Tests.csproj, Project2.Tests.csproj and Project3.Tests.csproj and coverlet shows tests coverage for each project separately. Wondering is there a possibility to collect total test coverage between all projects.

Collapse
 
mteheran profile image
Miguel Teheran

Coverlet always shows the namespaces separated but you also will see a total table at the end. you have to put the test dlls (binaries) in the same folder and run "dotnet test /p:CollectCoverage=true" there.

Collapse
 
fabasoad profile image
Yevhen Fabizhevskyi

Thanks, it is what I need actually! Also, I have added a few more command line arguments. Here is the command that works for me perfectly (just in case if anyone needs it):

dotnet test ./MySolution.sln /p:CollectCoverage=true /p:MergeWith=$(pwd)/coverage/coverage.json /p:CoverletOutput=$(pwd)/coverage/ "/p:CoverletOutputFormat=\"json,opencover\""
Thread Thread
 
mteheran profile image
Miguel Teheran

Sweet! Thanks for sharing it