【发布时间】:2017-02-24 17:45:41
【问题描述】:
我正在尝试将测试覆盖率报告和单元测试详细信息(测试用例的数量、通过的测试用例的数量)输入到声纳中。
我已经使用coverage 和nosetests 插件生成了报告并将其存储到coverage.xml 和nosetests.xml 中
我的 sonar.properties 文件看起来像
sonar.projectKey=python
sonar.projectName=Python
sonar.projectVersion=1.0
sonar.sources=vmturbo
sonar.tests=tests
sonar.language=py
sonar.sourceEncoding=UTF-8
sonar.python.xunit.reportPath=nosetests.xml
sonar.python.coverage.reportPath=coverage.xml
在运行 sonar-runner 时,我在日志中收到以下消息
0:29:51.022 INFO - Processing report '/Users/deepeshjain/Development/Python/CD/python-distribution/nosetests.xml'
00:29:51.027 WARN - The resource for 'vmturbo_unit_tests.Test' is not found, drilling down to the details of this test won't be possible
00:29:51.027 INFO - Sensor PythonXUnitSensor (done) | time=115ms
00:29:51.027 INFO - Sensor SCM Sensor
00:29:51.050 INFO - Sensor SCM Sensor (done) | time=23ms
00:29:51.051 INFO - Sensor Python Squid Sensor
00:29:51.221 INFO - Python unit test coverage
00:29:51.223 INFO - Parsing report '/Users/deepeshjain/Development/Python/CD/python-distribution/coverage.xml'
00:29:51.229 INFO - Python integration test coverage
00:29:51.232 INFO - Python overall test coverage
00:29:51.234 INFO - Sensor Python Squid Sensor (done) | time=183ms
我能够获得关于声纳的测试覆盖率报告,但无法获得相同的单元测试用例的数量。
【问题讨论】:
-
能够找到解决方案,我需要在 nostests.xml 中附加单元测试文件夹
标签: unit-testing nose coverage.py sonarqube5.6