Publish Code Coverage Results: coverage.py Cobertura xml not displaying result
See original GitHub issueUsing Azure DevOps
Issue Description
&view=codecoverage-tab
Error message
Code coverage data cannot be displayed. Please verify that a valid directory containing code coverage files, including an index.html was used to publish data.
Task logs
2018-09-20T18:21:24.1776880Z ##[section]Starting: Publish code coverage from $(System.DefaultWorkingDirectory)/**/coverage.xml
2018-09-20T18:21:24.1913796Z ==============================================================================
2018-09-20T18:21:24.1931112Z Task : Publish Code Coverage Results
2018-09-20T18:21:24.1947780Z Description : Publish Cobertura or JaCoCo code coverage results from a build
2018-09-20T18:21:24.1965544Z Version : 1.139.0
2018-09-20T18:21:24.1982934Z Author : Microsoft Corporation
2018-09-20T18:21:24.2001218Z Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=626485)
2018-09-20T18:21:24.2019569Z ==============================================================================
2018-09-20T18:21:26.9037822Z Reading code coverage summary from '/home/vsts/work/1/s/coverage.xml'
2018-09-20T18:21:27.0160754Z ##[section]Async Command Start: Publish code coverage
2018-09-20T18:21:27.0179363Z Publishing coverage summary data to TFS server.
2018-09-20T18:21:27.0197668Z Lines- 2804 of 6777 covered.
2018-09-20T18:21:27.0217477Z Branches- 0 of 0 covered.
2018-09-20T18:21:27.5243160Z Modifying Cobertura Index file
2018-09-20T18:21:27.5262744Z Publishing code coverage files to TFS server.
2018-09-20T18:21:27.5282332Z Uploading 1 files
2018-09-20T18:21:27.6041098Z File upload succeed.
2018-09-20T18:21:27.6060859Z Published '/tmp/Code Coverage Report_857678' as artifact 'Code Coverage Report_857678'
2018-09-20T18:21:27.6086468Z ##[section]Async Command End: Publish code coverage
2018-09-20T18:21:27.6169492Z ##[section]Finishing: Publish code coverage from $(System.DefaultWorkingDirectory)/**/coverage.xml
Troubleshooting
Lesson learned with other cloud providers: It will be nice if you can provide open-source solutions, so we debug our self the problem, find the error message on GitHub and understand the reason of the message, not like old style black box software.
People are trying different hacks to make the XML compatible with Azure DevOps:
- https://github.com/dazfuller/PyUnitTestTask/blob/master/src/reportgen.ts
- https://github.com/Microsoft/vsts-tasks/issues/2186#issuecomment-316074078
Tested both hacks without success, maybe is time to make something that it is working without losing the time of the developers to display coverage results that are working perfectly well in Coveralls.io, CircleCI, etc. more Python-friendly coverage environment 😃
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Code coverage report tab for python project does not show up
I am setting up a build pipeline that includes code coverage checks and I would like to display both the percental code coverage...
Read more >Publish code coverage results v1 task - Microsoft Learn
The publish code coverage results task generates and publishes the HTML report, which is a set of HTML files that are linked from...
Read more >python - Unable to publish code coverage in azure pipelines
Azure devops reportgenerator task can't find coverage.cobertura.xml · Publish code coverage not finding coverage file in Azure DevOps.
Read more >SonarQube reports zero coverage from coverage.xml ...
I create a coverage.xml file in Cobertura format and use the PublishCodeCoverageResults@1 task to upload it. I see the expected coverage results ......
Read more >how to view Code Coverage report on Azure DevOps - Code4IT
We'll see how to show Cobertura reports associated to your builds on Azure ... Even though 100% of code coverage is a good...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ugh. This is unacceptable sorry. Going to have to go with https://coveralls.io/ for now until the dev experience is improved.
I had the same issue with running code coverage on a Javascript project with
nyc
. First my configuration inazure-pipelines.yaml
was :I’ve updated the configuration to provide also an
index.html
, as I’ve read it should be present to display a summary on theCoverage
tab.Basically I’ve added the
--reporter=html
to the script that build the code coverage:The default output displays the summary but it’s really awful :
I’ve eventually understood that all assets are removed (css, scripts, …). I’ve added a new step to inline all CSS into final
index.html
file and it looks better !