Skip to content
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

Publish Coverage Results in Azure DevOps #70

Open
asos-eugeneniemand opened this issue May 20, 2021 · 1 comment
Open

Publish Coverage Results in Azure DevOps #70

asos-eugeneniemand opened this issue May 20, 2021 · 1 comment

Comments

@asos-eugeneniemand
Copy link

Describe the bug
When using the Cobertura format and using the Publish Coverage Results task in ADO I get the following results in the logs

"C:\Program Files\dotnet\dotnet.exe" C:\Agent\_work\_tasks\PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97\1.186.0\netcoreapp2.0\ReportGenerator.dll -reports:C:\Agent\_work\101\a/**/code-coverage-report*.xml -targetdir:C:\Agent\_work\_temp\cchtml -reporttypes:HtmlInline_AzurePipelines
2021-05-20T14:44:42: Arguments
2021-05-20T14:44:42:  -reports:C:\Agent\_work\101\a/**/code-coverage-report*.xml
2021-05-20T14:44:42:  -targetdir:C:\Agent\_work\_temp\cchtml
2021-05-20T14:44:42:  -reporttypes:HtmlInline_AzurePipelines
2021-05-20T14:44:43: File '' does not exist (any more).
... (1120 more lines)
2021-05-20T14:44:44: File '' does not exist (any more).
2021-05-20T14:44:46: Writing report file 'C:\Agent\_work\_temp\cchtml\index.html'
2021-05-20T14:44:46: Report generation took 3.5 seconds
Generated code coverage html report: C:\Agent\_work\_temp\cchtml
Reading code coverage summary from 'C:\Agent\_work\101\a\_core-edw-combined-ci\core-edw-dwh-tests\DiFramework.UnitTests\code-coverage-report-datawarehouse-2021-05-20T14.44.30.xml'
Async Command Start: Publish code coverage
Publishing coverage summary data to TFS server.

When looking at the published result in ADO it has the metrics but not the file or code, see screenshot below
image

I've noticed there is a field on the taks called Path to Source files with the following tooltip

Path to source files is required when coverage XML reports do not contain absolute path to source files. For e.g., JaCoCo reports do not use absolute paths and when publishing JaCoCo coverage for Java apps, the pattern would be similar to $(System.DefaultWorkingDirectory)/MyApp/src/main/java/.
This input is also needed if tests are run in a docker container. This input should point to absolute path to source files on the host. For e.g., $(System.DefaultWorkingDirectory)/MyApp/

We are not using JaCoCo so I'm not sure if the Cobertura format generated by SQLCover is incorrect or if I need to supply something in the Path to Source files field to make this work correctly

Any ideas are welcome, thanks.

@GoEddie hope you are well mate :)

@ManiAc4734
Copy link

I had a similar problem, and I think it was solved by making sure that the sourcefiles and xml are in the same folder. I did this by adding a line in my powshell to save the SourceFiles , which effectivley copies these files to the specified location

$result.SaveSourceFiles($outputPath)

So I think this works becuase the source files in the code-coverage-report.xml are referenced in relation to where the code-coverage-report.xml resides. For example in your code-coverage-report.xml
you should see the filename dos not contain the full path
Unless there is a way to populate the full filepath to the soriginal source files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants