【发布时间】:2015-12-19 08:04:24
【问题描述】:
我在 Python 项目中遇到了一个关于 Sonar-Runner 的奇怪问题。 这是我的conf: SonarQube:5.1.2 声纳亚军:2.4 Python 插件:1.5
我有一个简单的 Python 项目“PyTest”:
- 测试
- 报告
- pgm.py
- VO.py
我使用nose (v1.3.7) 通过这个命令生成coverage 和xunit 文件:
nostetests --with-coverage --cover-xml --cover-inclusive --with-xunit --xunit-file=reports/xunit.xml --cover-xml-file=reports/cover.xml
我使用“pytestkey”配置 Sonar,这是我的 sonar-project.properties
sonar.projectKey=pytestkey
sonar.projectName=PyTest
sonar.projectVersion=1.0
sonar.sources=.
sonar.tests=tests
sonar.language=py
sonar.exclusions=tests/*
sonar.python.xunit.reportPath=reports/xunit.xml
sonar.python.coverage.reportPath=reports/cover.xml
sonar.python.codeCoveragePlugin=cobertura
当我运行时,一切都找到了,除了 xunit.xml 文件永远不会被解析...
日志:
INFO - Sensor PythonXUnitSensor
DEBUG - Using pattern 'reports/xunit.xml' to find reports
INFO - Sensor PythonXUnitSensor (done) | time 19ms
INFO - Sensor PythonCoverageSensor
DEBUG - Using pattern 'reports/cover.xml' to find reports
INFO - Parsing report '/home/bsantus/workspace/PyTest/reports/cover.xml'
DEBUG - Saving coverage measures for file 'pgm.py'
DEBUG - Saving coverage measures for file 'VO.py'
DEBUG - Parsing integration test coverage reports
DEBUG - Using pattern 'coverage-reports/it-coverage-*.xml' to find reports
DEBUG - Parsing overall test coverage reports
DEBUG - Using pattern 'coverage-reports/overall-coverage-*.xml' to find reports
INFO - Sensor PythonCoverageSensor (done) | time 65ms
知道为什么不使用 xunit.xml 文件吗?
谢谢大家
【问题讨论】:
-
为什么您认为您的报告没有被使用?您在 SonarQube 中看到了什么?
-
事实上,我注意到使用了元信息(测试数、成功数、失败数),但它们在 Sonar 中没有可让我浏览测试文件和测试结果的钻取。在阅读了有关 Sonar-runner 的更多信息后,我认为 Sonar 无法将测试结果与源文件相关联。
标签: python report sonarqube nosetests xunit