I am a .net-core core user trying to figure out how to generate a HTML test coverage report using reportgenerator.
I have managed to collect code cobertura coverage statistics. These exist within test assemblies projects under Tests/:
dotnet test --collect:"XPlat Code Coverage"
I am trying to use reportgenerator to produce a HTML coverage report from these files.
I have tried the following commands, none of which find any matching coverage statistics:
dotnet reportgenerator -reports:./Tests/**/coverage.cobertura.xml
dotnet reportgenerator -reports:Tests/**/coverage.cobertura.xml
dotnet reportgenerator -reports:./Tests/UnitTests/**/coverage.cobertura.xml
dotnet reportgenerator -reports:Tests/UnitTests/**/coverage.cobertura.xml
All of the above commands generate the following output:
zsh: no matches found: -reports:Tests/**/coverage.cobertura.xml
I have verified that the path is correct, e.g. ls Tests
and ls Tests/UnitTests
Has anyone managed to generate a HTML coverage report with reportgenerator, using globbing so that the test coverage statistic files will be recursively matched and merged?
Update @Daniel It works!
I think the targetDir must be a mandatory option so the full working command is:
dotnet reportgenerator "-reports:Tests/UnitTests/**/*.xml" "-targetDir:coveragereports"