Merge Coverage Files generated using collectors integration
See original GitHub issueWe’re suffering from the first issue mentioned here, we see 0% code coverage when running integration tests (The tests use the asp.net core WebApplicationFactory/testhost method for spinning up an in-memory web hostserver)
Example:
dotnet test src\Project.IntegrationTests -c Release --no-build --logger:trx ^ --results-directory %testresults%/IntegrationTests ^ /p:CollectCoverage=true ^ /p:CoverletOutput=%testresults%\Coverage\ ^ /p:\"CoverletOutputFormat=cobertura,json\"
This sadly produces the 0% coverage on all lines/methods/classes etc as mentioned in the known issue document.
The suggested fix in the Known Issues document works a charm, using
dotnet test src\Project.IntegrationTests -c Release --no-build --logger:trx --results-directory %testresults%/IntegrationTests --collect:"XPlat Code Coverage"
Produces plenty of code coverage metrics as expected, and can see those when we feed the coverage.cobertura.xml file into reportgenerator.
However as far as I know, the above dotnet test ONLY produces test coverage data in the coverage.cobertura.xml format, which can’t be merged with coverage.coberatura.xml files from further test projects (e.g see this error).
Is there a way to achieve any of the following:
- Have collect:"XPlat Code Coverage spit out JSON coverage data to merge future dotnet tests with?
- Merge the coverage.cobertura.xml files instead? (n.b. we are also relying on the
| Total | 100% | 100% | 100% | getting spat out in the console to ensure 100% coverage)
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top GitHub Comments
Thanks I’ll give that a real go, couldn’t seem to get the code coverage happening in proc the last time but will try with confidence this time.
Will close if no further issues
Closing for stale conversation, feel free to reopen if needed.