- dotnet test /p:CollectCoverage=true
- dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:Exclude=“[xunit*]*” /p:CoverletOutput=“./TestResults/”
- dotnet reportgenerator “-reports:TestResults/coverage.cobertura.xml” “-targetdir:TestResults/html” -reporttypes:HTML;
This is the script i’m using in gitlab for code-coverage but i’m not able to run the reportgenerator commands in this pipeline.
This means you didn’t install
reportgenerator in the CI (pipeline) or you are invoking it incorrectly. There are few ways to install it, so make sure the tool is installed correctly and then you invoke it correctly. How you use it (invoke it), depends on the installation method.
E.g. we are using it with dotnet tools… so we have added it to the
Then, it’s installed automatically (with the rest of the tools) in the pipeline using:
dotnet tool restore
dotnet tool run reportgenerator -reports:./dotCoverReport/dotCoverReport.xml -targetdir:./coveragereport -reporttypes:"Html;Cobertura;SonarQube;Badges"
Hope this helps!
Thank you, I’ll try this way now and I have another issue,
If I use coverlet install command its showing not found error. So, How to install coverlet in gitlab ci/cd pipeline…?
Firstly, maybe you could post your CI/CD config here so it’s easier to understand how your script looks at the moment?
Secondly, did you consult the official coverlet docs? There are three possible ways to install it, so I’d suggest you start from there.