Hi, i am needing a help
My sonar don’t register the code coverage values, show only 0%, below is my the azure pipeline
jobs:
- job:
displayName: Sonar
pool:
name: default
steps:
- task: SonarQubePrepare@5
inputs:
SonarQube: SonarQube
scannerMode: CLI
configMode: manual
cliProjectKey: ${{parameters.ProjectName}}
extraProperties: |
sonar.verbose=true
sonar.python.version=3.8
sonar.sources=.
sonar.tests=.
sonar.test.inclusions=**/*.tests.*
sonar.language=py
sonar.python.coverage.reportPaths=$(System.DefaultWorkingDirectory)/**/cobertura-coverage.xml
sonar.python.xunit.reportPath=$(System.DefaultWorkingDirectory)/$(EnginePath)/test.xml
sonar.exclusions=**/*.sql,**/*.pks,**/*.pkb,**/*__init__.py,**/*main.py
sonar.sourceEncoding=UTF-8
- script: coverage run -m pytest
displayName: 'Run unit tests'
- script: coverage xml
displayName: 'Run code coverage'
- task: PublishCodeCoverageResults@1
displayName: 'Publish CodeCoverage Results'
inputs:
codeCoverageTool: coverage
summaryFileLocation: $(System.DefaultWorkingDirectory)/**/coverage.xml
# Run Code Analysis task
- task: SonarQubeAnalyze@5
# Publish Quality Gate Result task
- task: SonarQubePublish@5
inputs:
pollingTimeoutSec: '300'
INFO
17:19:06.552 INFO: Sensor Python Sensor [python] (done) | time=30529ms
17:19:06.552 INFO: Sensor Cobertura Sensor for Python coverage [python]
17:19:06.552 DEBUG: Using pattern 'D:\TFS\Agents\TPRB1048-v3_1\_work\71\s/**/cobertura-coverage.xml' to find reports
17:19:06.669 WARN: No report was found for sonar.python.coverage.reportPaths using pattern D:\TFS\Agents\TPRB1048-v3_1\_work\71\s/**/cobertura-coverage.xml
17:19:06.669 INFO: Sensor Cobertura Sensor for Python coverage [python] (done) | time=117ms
17:19:06.670 INFO: Sensor PythonXUnitSensor [python]
17:19:06.670 DEBUG: Using pattern 'D:\TFS\Agents\TPRB1048-v3_1\_work\71\s/$(EnginePath)/test.xml' to find reports
17:19:06.785 WARN: No report was found for sonar.python.xunit.reportPath using pattern D:\TFS\Agents\TPRB1048-v3_1\_work\71\s/$(EnginePath)/test.xml
17:19:06.786 INFO: Sensor PythonXUnitSensor [python] (done) | time=115ms
17:19:06.786 INFO: Sensor JaCoCo XML Report Importer [jacoco]
17:19:06.787 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
17:19:06.789 INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
17:19:06.789 INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=3ms
17:19:06.789 INFO: Sensor JavaScript inside YAML analysis [javascript]
17:19:06.800 INFO: No input files found for analysis
17:19:06.801 INFO: Hit the cache for 0 out of 0
17:19:06.802 INFO: Miss the cache for 0 out of 0
–
SonarQubeEnterprise LTS 9.9
Python version is 3.8.8