It's a very basic problem and should have a simple solution. I want to have all the code coverage results for my unit tests project in a solution to output in a single directory. Currently, all the coverage output files are being written in the individual test project folder. I tried to look into the coverlet github issues where in they mentioned that they have a workaround (https://github.com/tonerdo/coverlet/pull/220) for this to merge all the coverage files into a single one but I couldn't place them into my solution directory
dotnet test .\MySolution.sln /p:CollectCoverage=true /p:CoverletOutput=/results/coverage /p:MergeWith=\results\coverage.json /p:CoverletOutputFormat='json%2copencover'
What I am struggling is to specify the solution directory in the /p:CoverletOutput
parameter. Is there a special paramter in dotnet cli to point to the solution directory similar to what we have in msbuild $(MSBuildProjectDirectory)
?
Just so anyone interested in the answer, the following script works well in windows machine
dotnet test MySolution.sln /p:CollectCoverage=true /p:CoverletOutput=..\results\coverage
/p:MergeWith=..\results\coverage.json /p:CoverletOutputFormat=\"opencover,json\"