1

Sonar 无法显示 Cobertura 生成的 Python 模块的代码覆盖率。我目前正在使用 Jenkins 来构建和集成声纳。我的声纳属性是:

# Info required for Sonar
sonar.sources=module
sonar.language=py

# Additional Configuration
sonar.python.xunit.reportPath=**/nosetests.xml
sonar.python.coverage.reportPath=**/coverage.xml

控制台输出显示:

12:03:26.458 INFO  - Sensor PythonXunitSensor...
12:03:27.305 INFO  - Processing report 'nosetests.xml'
12:03:27.305 INFO  - Parsing report 'nosetests.xml'
12:03:27.460 INFO  - Sensor PythonXunitSensor done: 1002 ms
12:03:27.460 INFO  - Sensor PythonCoverageSensor...
12:03:28.216 INFO  - Parsing report 'coverage.xml'
12:03:28.269 INFO  - Sensor PythonCoverageSensor done: 809 ms
12:03:28.269 INFO  - Sensor CpdSensor...
12:03:28.270 INFO  - SonarBridgeEngine is used
12:03:28.426 INFO  - Cross-project analysis disabled
12:03:29.181 INFO  - Sensor CpdSensor done: 912 ms

但在声纳中,我只看到单元测试结果,但没有覆盖数据,当我使用调试选项运行时,它说:

16:51:23.124 DEBUG - Cannot find the file , ignoring coverage measures
16:51:23.125 DEBUG - Cannot find the file , ignoring coverage measures
16:51:23.125 DEBUG - Cannot find the file , ignoring coverage measures
16:51:23.126 DEBUG - Cannot find the file , ignoring coverage measures
16:51:23.126 DEBUG - Cannot find the file , ignoring coverage measures

我也检查了案例和路径,但没有发现问题。谁能帮我?

4

2 回答 2

3

我有一个类似的问题。coverage.xml 文件中的路径错误,我只是运行 sed 命令来替换所有文件路径以添加模块目录。

于 2013-10-23T09:13:43.127 回答
-1

尝试添加sonar.python.coveragePlugin=cobertura到您的声纳属性并再次运行。

于 2013-11-28T00:58:28.973 回答