-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VsTest Code Coverage is broken by design #11677
Comments
@NKnusperer - VsTest Task do upload .coverage file as an artifact. Can you please share logs by setting system.debug = true ? Alternatively , For a first class view , we are soon going to roll out this the following: If you are interested in this , we will enable this on your account in couple of days. |
@anshii03 I'm interested in this view |
@andrebriggs - Please share your account details. We will enable it on your account and let you know. |
@NKnusperer - we would love to share this view with you. Please share your account details so that we can enable it on your account as well. |
@anshii03 we are using an on-premises installation so guess this is not possible? |
Yes , not possible on on-premises. |
@NKnusperer - You can share the logs by setting system.debug = true . We do upload .coverage file as an artifact. |
@anshii03 I cannot do this at the moment, however one more thing to mention is that we are running Unit Tests in parallel using multiple build agents. |
@NKnusperer Publishing multiple coverage reports through publish code coverage task won't work. This is by design as merging of code coverage data is not supported: - https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/test/publish-code-coverage-results?view=azure-devops#q--a |
VsTest Task do upload .coverage files as an artifact. And Publish Code Coverage Task don't publish multiple code coverage reports as mentioned in doc https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/test/publish-code-coverage-results?view=azure-devops#q--a Alternatively , Private preview is ready for the new first class view : If anyone is interested , please mail your account details on devops_tools@microsoft.com. Hence , closing this ticket. |
@anshii03 Any idea when this becomes generally available? |
I'm interested and emailed devops_tools@microsoft.com, but received this in response: |
Is this code coverage view going to be made available soon for Azure DevOps Server 2019? It appears to only be available currently for microsoft hsoted Azure DevOps services. |
@anshii03 I'm seeking to enable this in my org too. how can we connect in DM for the details you would need. |
I have sent mail to devops_tools@microsoft.com and still waiting it to be assigned to someone right. can someone please help? |
This issue needs to be Re - Opened because the proposed feature enable to display the html by default never came to light. And every new user of VsTest task integrating on the ADO is facing the same race condition.
Proposal: why can't codecoverage (from VsTest task) also output the .xml by default? It's upto the use to consume it or not. |
@ShreyasRmsft @anshii03 this issue needs to be definitely re-opened, we are facing a similar problem (very well described here microsoft/vstest#981 (comment)) |
Yes, we definitely recommend rewriting the code for this tool. However, the issue still persists as it doesn't generate a coverage report, which is essential for checking the code coverage in .NET 6. In my case, I'm using two different unit test tasks: one for differential code coverage and another one for regular code coverage. Unfortunately, we do not have the option to verify code coverage with the previous build (last committed/merged code coverage) if we select coverageFailOption as the build. This means it's literally comparing with the previous build in the same PR, and if the code coverage is the same as the previous build, it doesn't allow us to merge the code :( |
Environment
mcr.microsoft.com/dotnet/framework/runtime:4.8-20190709-windowsservercore-1903
VsTestPlatformToolInstaller
Issue Description
With
codeCoverageEnabled: true
theVsTest
task generates a proprietary.coverage
file which cannot be consumed by Azure DevOps /PublishCodeCoverageResults
nor is it published as an artifact.The only supported formats are
Cobertura
andJaCoCo
.Reading the docs for
PublishCodeCoverageResults
it says :https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/test/publish-code-coverage-results
This is wrong because the
VsTest
task neither converts the resulting.coverage
to a supported file format nor uploads the raw.coverage
file as an artifact.But the story continues...
So if the task itself does not produce a valid output why not simply convert the
.coverage
file toCobertura
using danielpalme/ReportGenerator and then usePublishCodeCoverageResults
?Unfortunately this is also not possible because of #6279.
The
.coverage
file does not exist anymore after a test run so there is nothing we could do with it.This effectively renders the complete code coverage feature of the
VsTest
task useless.Obviously we could use a simple script to execute our tests with enabled code coverage and then do the file conversion, but then we would also loos all the nice features of the
VsTest
task like distributed batching and flaky test detection.Proposal
It would be great to get some generic infrastructure to use any code coverage tool which would resolve the issue in the first place.
Because most of the the time these tools works the same (you just run them with an argument telling them what other executable to run) this should be quite simple?
Degenerated example using dotCover:
dotCover.exe cover --TargetExecutable=$(vsTestExecutable) --TargetArguments=$(vsTestArguments) --ReturnTargetExitCode
The text was updated successfully, but these errors were encountered: