Deployment method: Docker (not completely sure. we are using it in Github Actions)
Objective:
I am attempting to generate a coverage report in cobertura.xml format and have SonarQube process this report to display the results on the dashboard.
Attempts So Far:
Converted report generation from JSON to cobertura.xml format.
Uploaded and downloaded the coverage report as an artifact in GitHub Actions.
Passed the coverage report as reportsPath in the Sonar Scan.
Confirmed that the Build and Analyze step completes successfully.
Despite these steps, the SonarQube Dashboard does not show any results. I have ensured that the file path to the cobertura.xml report is correct and that the report is formatted correctly as confirmed by successful import logs in the Sonar Scan job.
Detailed Explanation
I am working on a workflow in GitHub Actions that generates a test coverage report using coverlet. Initially, the report was generated in JSON format, but since SonarQube does not support JSON for reports, I have updated the generation to output in cobertura.xml format. And also if I want to use ReportGenerator to convert report type to any other format so I will use cobertura.xml
The generated unit test coverage report is uploaded as an artifact and subsequently downloaded in the Sonar Scan job. The purpose is to perform a sonar scan and integrate the results into the Sonar Dashboard. The coverage report is stored at the location /github/workspace/cobertura.xml and it is successfully imported into the Sonar Scan job.
The coverage report is getting successfully imported in Sonar Scan Job
I suggest stepping back and looking through the documentation on .NET Test Coverage, which details supported formats and gives examples for generating files in those formats.
So the error what I am facing is that the application is running in $GITHUB_WORKSPACE
which has all of the files also the CameraSystemService/CameraSystem.cs
But the opencover coverage.xml file check the File’s fullpath in “/github/workspace/CameraSystemService/CameraSystem.cs” where in the running directory there is no /github/workspace folder having this content so we are getting this issue
But I even worked on creating a folder in $GITHUB_WORKSPACE as ./github/workspace and copy pasted the folder CameraSystemService/* into it but still I am getting the same error
Hey @Colin, I tried a different method to get the data on SonarQube dashboard and it worked. I have created another discussion to clarify one of the doubt which I have regarding getting different coverage % in local scan and SonarQube dashboard