Sonar-Xunit文件未被声纳转轮解析

时间:2015-09-22 11:06:57

标签: python report sonarqube nosetests xunit

我对Sonar-Runner在Python项目上有一个奇怪的问题。 这是我的conf: SonarQube:5.1.2 Sonar Runner: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文件?

全部谢谢

1 个答案:

答案 0 :(得分:0)

您的报告已经过解析,但Python插件1.5版的默认行为是仅记录项目级指标。 您应该尝试将以下行添加到sonar-project.properties:

<div class="outer"><div class="inner-1"></div><div class="inner-2"></div></div>