-
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
How can I publish coverage data (.coverage files) to Azure DevOps Server 2020? #15092
Comments
Adding @suyash691 , @ankit-arora12 and @nadesu for follow up and closure. |
|
I understand the VSTest task will generate code coverage data, but we have a very large codebase and a heavily optimized build process; we can't use the out-of-the-box VSTest task because it is not performant. What we want to do is publish the .trx/.coverage files after we run the tests ourselves. According to the documentation, "Publish Test Results" is the correct task for that. |
Ah I missed that you were talking about the publish test results. But I think it will not work with the vstest task either. I personally have not tried but have you taken a look at https://docs.microsoft.com/en-us/azure/devops/pipelines/test/parallel-testing-vstest?view=azure-devops-2020 to use VSTest? |
Thanks. We are aware of the parallel testing support, but there are still a few things we do that don't fit this model. For instance, we set up and tear down dedicated databases before running certain tests. We also start testing before our entire codebase is compiled. By starting low-level assembly tests before high-level assemblies are compiled, we get a significant performance boost. |
@v-pkoneti / @v-vnomula - pls take a look |
@mwelsh1118 Please make sure that .coverage and .trx files are present in the same folder so that PublishTestResults task will take care of uploading .coverage file to blob. |
@v-vnomula We are using xUnit, so we have .xml result files that we upload via PublishTestResults. Are you saying this only works with MS Test/.trx results? |
Hi, I have resolved this using two different pipelines as described here: microsoft/vstest#981 (comment) |
@v-vnomula Could you please provide an example how to upload .coverage file to the blob? I tried like that:
And here is the log from that task:
As I can see, it finds and tries to parse .coverage file, which fails the process. |
This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days |
@mwelsh1118 Did you ever find a solution to this? I just figured since .coverage files are generated by “dotnet test” that it would work seamlessly but boy was I wrong. I got the “convert to xml” when using the publish code coverage task. |
We came up with a custom solution based on the dotnet-coverage tool: |
Required Information
Type: Question
Enter Task Name: Publish Test Results
Environment
Azure DevOps Server 2020
Private agents hosted on Windows Server 2016
Issue Description
According to the documentation for Publish Test Results:
"You can also use this task in a build pipeline to publish code coverage results produced when running tests to Azure Pipelines or TFS in order to obtain coverage reporting."
I have tested this by running vstest.console.exe with coverage enabled to produce a .trx that references a .coverage file. I then use the Publish Test Results task, pointing to the trx. I see the test results in my build, but below that it still shows the link for "Setup code coverage" indicating the coverage data was not uploaded.
We are particularly interested in code coverage for pull requests. Under the FAQ it mentions:
"This can be used if you publish code coverage using the Visual Studio Test task, the test verb of dotnet core task and the TRX option of the publish test results task."
What is the correct way to publish .coverage files?
I looked at the Publish Code Coverage Results task, but that only accepts JaCoCo or Cobertura results, meaning we would need to translate the .coverage into one of those formats first. Besides, it sounds like that would not work for the pull request functionality we want.
The text was updated successfully, but these errors were encountered: