Hey everyone,
In my current setup, we run dotnet test for individual DLLs (we parallelize test execution that way). Is there a way to pick up partial coverage results from running tests for a single DLL and compute full coverage from each of the smaller ones?
Thank you,
S茅rgio
You can use https://github.com/danielpalme/ReportGenerator which can combine several test result files into one.
Hi @sergiusignacius if you're using msbuild integration you can use MergeWith https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/Examples/MSBuild/MergeWith/HowTo.md
Other coverlet drivers like .NET tool and collectors doesn't have this feat yet.
As @Happypig375(thanks a lot for the help!) said you can also use other tools like ReportGenerator.
Thanks @Happypig375 and @MarcoRossignoli these are great! We are indeed using msbuild and I had one last question: in trying to run dotnet test for a single DLL, the parameters we should use end up not being recognized:
The argument /p:CollectCoverage=true is invalid. Please use the /help option to check the list of valid arguments.
I do not get the same behavior when running dotnet test on a project or on a solution. Is this expected?
Thanks yet again!
dotnet test doesn't support msbuild arguments. You must either use coverlet.collector or do a dotnet build before dotnet test --no-build.
dotnet test for a single DLL
Can you elaborate better?Can you attach all the command line?
Yup:
dotnet test .\bin\x64\...\test.dll /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:Exclude="[xunit*]\*"
Oh now it's clear...yes as @Happypig375 said you cannot do that using artifact(dll) because msbuild integration inject coverage during build.
So follow Hadrian's advice or use collectors https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/VSTestIntegration.md
Closed for stale coversation.
Most helpful comment
Hi @sergiusignacius if you're using msbuild integration you can use
MergeWithhttps://github.com/coverlet-coverage/coverlet/blob/master/Documentation/Examples/MSBuild/MergeWith/HowTo.mdOther coverlet drivers like .NET tool and collectors doesn't have this feat yet.
As @Happypig375(thanks a lot for the help!) said you can also use other tools like ReportGenerator.