question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature Request: New dotnet tool command for merging results in standalone mode

See original GitHub issue

N.B. Alert! 😃 I just started looking into adopting coverlet for our code coverage purpose. We run tests across many different modules not only with parallelism within the test job, but also across several different jobs running in parallel in our pipeline. Having to run tests in serial would be a huge (and unacceptable) blow back to our pipeline latency. Aside from that, I’ve noticed from several threads in here that MergeWith has its issues right now, even when executing tests in parallel. So I have a feature request, that should be fairly easy to implement. In fact, I just prototyped it for myself:

Why not have a dotnet tool command for merging existing json reports into a single final report. That way one can still do a massively parallel testing, and just run the command to merge all the results together. That command seems to be performing well even if results are merged in a single thread, but ultimately if needed, can be further enhanced to work in a multi-threaded mode using concurrent dictionaries and what not to replace the existing single-threaded data structures that are used for representing the results.

So, the pipeline would look like this (an approximation of the actual syntax just to convey the point):

- job: Build
  steps:
     - dotnet build test.sln
- job: Test
  dependsOn: Build
  strategy:
    - parallel: n
  steps:
    - dotnet test test.sln --no-build --collect:"XPlat Code Coverage" -s ./test.runsettings
    - Copy ./**/coverage.json to $(build.artifactStagingDirectory)/cc
       Flatten: true
    - publish $(build.artifactStagingDirectory)/cc
      artifact: CC_$(System.JobPositionInPhase)
- job: CodeCoverage
  dependsOn: Test
  steps:
    - download
       patterns: 'CC_*'
       path: $(pipeline.workspace)/coverageResults
    - dotnet merge-coverage-reports $(pipeline.workspace)/coverageResults/**/coverage.json -o $(pipeline.workspace)/coverageResults/merged -f json,cobertura
    - publishCodeCoverage: $(pipeline.workspace)/coverageResults/merged

Does this sound reasonable?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
jakubch1commented, Dec 16, 2020

As part of this: https://github.com/microsoft/vstest/issues/1811 effort we will also add extensibility for other data collectors (for example coverlet). Then we also want to onboard coverlet to this logic.

At the end running dotnet test --collect "XPlat Code Coverage" should generate 1 coverage report with merged information even when running in parallel.

1reaction
MarcoRossignolicommented, Dec 15, 2020

It has been discussed to add separate merge steps, but I can’t find the issue for that now.)

This was the discussion https://github.com/coverlet-coverage/coverlet/issues/683#issuecomment-576325784

could mean trouble going through approval process.

Report generator is used also by AzDo https://docs.microsoft.com/en-us/azure/devops/release-notes/2019/sprint-150-update#cobertura-code-coverage-report-updates FYI if you need some proof in your approval process

Read more comments on GitHub >

github_iconTop Results From Across the Web

dotnet-coverage code coverage tool - .NET CLI
dotnet -coverage merge​​ The merge command is used to merge several code coverage reports into one. This command is available on all platforms....
Read more >
dotnet tool install command - .NET CLI
Description. The dotnet tool install command provides a way for you to install . NET tools on your machine. To use the command,...
Read more >
NET tools - .NET CLI
Here are some ways to find tools: Use the dotnet tool search command to find a tool that's published to NuGet.org. Use the...
Read more >
What's new in .NET Framework
See what's new in various versions of .NET Framework. Read a summary of key new features and improvements in each version.
Read more >
dotnet-counters diagnostic tool - .NET CLI
Learn how to install and use the dotnet-counter CLI tool for ad-hoc health monitoring and first-level performance investigation.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found