which versions are you using (SonarQube * Enterprise Edition v9.9.5 (build 90363))
how is SonarQube deployed: not sure, we have sonarqube server, and we run scanner from azure cicd pipeline and publish report to server.
what are you trying to achieve:
get coverate rate as showing in the coverate report generated by pytest-cov
what have you tried so far to achieve this?
I ran pytest-cov to get the unit test xml file and coverage file, then run sonar scanner and analysis to import the xml reports. I have set the property:
sonar.python.coverage.reportPaths=C:\tlm-data\coverage\test_inventory_loading_coverage.xml, and according the debug information, the report has been imported successfully.
But the coverage rate in dash board is 0% always for new and overall.
Do not share screenshots of logs ā share the text itself (bonus points for being well-formatted)!
.......
2024-10-17T02:55:01.7689597Z 02:55:01.765 INFO 509/509 source files have been analyzed
2024-10-17T02:55:01.7689978Z 02:55:01.765 INFO The Python analyzer was able to leverage cached data from previous analyses for 0 out of 509 files. These files were not parsed.
2024-10-17T02:55:01.7690357Z 02:55:01.765 INFO Sensor Python Sensor [python] (done) | time=263956ms
2024-10-17T02:55:01.7690674Z 02:55:01.765 INFO Sensor Cobertura Sensor for Python coverage [python]
2024-10-17T02:55:01.7698024Z 02:55:01.765 DEBUG Using pattern 'C:\tlm-data\coverage\test_inventory_loading_coverage.xml' to find reports
2024-10-17T02:55:02.5049944Z 02:55:02.500 INFO Python test coverage
2024-10-17T02:55:02.5073968Z 02:55:02.500 INFO Parsing report 'C:\tlm-data\coverage\test_inventory_loading_coverage.xml'
2024-10-17T02:55:02.5608656Z 02:55:02.547 INFO Sensor Cobertura Sensor for Python coverage [python] (done) | time=782ms
2024-10-17T02:55:02.5610064Z 02:55:02.547 INFO Sensor PythonXUnitSensor [python]
2024-10-17T02:55:02.5611031Z 02:55:02.547 DEBUG Using pattern '"C:\tlm-data\unit-test\test_inventory_loading_unitest.xml"' to find reports
2024-10-17T02:55:03.2641718Z 02:55:03.250 WARN No report was found for sonar.python.xunit.reportPath using pattern "C:\tlm-data\unit-test\test_inventory_loading_unitest.xml"
2024-10-17T02:55:03.2642277Z 02:55:03.250 INFO Sensor PythonXUnitSensor [python] (done) | time=703ms
2024-10-17T02:55:03.2642606Z 02:55:03.250 INFO Sensor JaCoCo XML Report Importer [jacoco]
2024-10-17T02:55:03.2656435Z 02:55:03.250 INFO 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
2024-10-17T02:55:03.2665975Z 02:55:03.265 INFO No report imported, no coverage information will be imported by JaCoCo XML Report Importer
2024-10-17T02:55:03.2666732Z 02:55:03.265 INFO Sensor JaCoCo XML Report Importer [jacoco] (done) | time=15ms
2024-10-17T02:55:03.2667268Z 02:55:03.265 INFO Sensor JavaScript inside YAML analysis [javascript]
2024-10-17T02:55:03.2976561Z 02:55:03.281 INFO No input files found for analysis
2024-10-17T02:55:03.2980335Z 02:55:03.297 INFO Hit the cache for 0 out of 0
2024-10-17T02:55:03.2990793Z 02:55:03.297 INFO Miss the cache for 0 out of 0
2024-10-17T02:55:03.2991522Z 02:55:03.297 INFO Sensor JavaScript inside YAML analysis [javascript] (done) | time=32ms
2024-10-17T02:55:03.2992109Z 02:55:03.297 INFO Sensor CSS Rules [javascript]
2024-10-17T02:55:03.3027503Z 02:55:03.297 INFO No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
......
While the coverage file is correctly found by the analyzer, we suspect our analyzer is not able to map the findings of the coverage reports into actual files, due to the configuration of your CICD.
Can you check whether the file locations in the coverage report are expressed using relative paths or absolute paths?
We are considering improving the logs to identify cases where we could not import anything while actually reading the coverage report, but it would help to know if this is what is affecting you here.