【发布时间】:2016-03-22 22:40:22
【问题描述】:
SonarRunner 有以下问题。
SonarQube 和 Sonar runner 无法提取 junit 格式的 xml 报告
单元测试或测试覆盖率小部件不显示。它说没有数据。 我正在按照here 描述的说明进行操作
我按照描述手动创建了 XML 格式的报告文件,但仍然没有成功。
下面是 XML 文件 - TEST-Firefox_210_Mac_OS.com.company.BarTest.xml,
<testsuite name="Firefox_210_Mac_OS.com.company.BarTest" errors="0" failures="0" tests="3" time="0.0">
<testcase classname="Firefox_210_Mac_OS.com.company.BarTest" name="testfullName" time="0.0"/>
</testsuite>
拉取单元测试执行报告以显示在声纳仪表板上。我使用了来自here的示例git项目
以下是我的sonar-project.properties,
# project metadata (required)
sonar.projectKey=org.codehaus.sonar:javascript-sonar-runner-jstestdriver
sonar.projectName=JavaScript project with Sonar Runner reusing reports generated by JsTestDriver
sonar.projectVersion=1.0
# path to source directories (required)
sonar.sources=C:/Sonar/sonar-runner-dist-2.4/sonar-runner-2.4/projects/sources
# path to tests source directories (required)
sonar.tests=C:/Sonar/sonar-runner-dist-2.4/sonar-runner-2.4/projects/tests
sonar.javascript.jstestdriver.reportsPath=C:/Sonar/sonar-runner-dist-2.4/sonar-runner-2.4/projects/target/TEST-Firefox_210_Mac_OS.com.company.BarTest.xml
sonar.sourceEncoding=UTF-8
下面是我的 jsTestDriver.conf
server: http://localhost:9876
load:
- C:/Sonar/sonar-runner-dist-2.4/sonar-runner-2.4/projects/sources/*.js
- C:/Sonar/sonar-runner-dist-2.4/sonar-runner-2.4/projects/sources/com/company/*.js
test:
- C:/Sonar/sonar-runner-dist-2.4/sonar-runner-2.4/projects/tests/*.js
- C:/Sonar/sonar-runner-dist-2.4/sonar-runner-2.4/projects/tests/com/company/*.js
plugin:
- name: "coverage"
jar: "coverage-1.3.5.jar"
module: "com.google.jstestdriver.coverage.CoverageModule"
我的 sonarqube 在端口:9000 及以下是屏幕截图。如您所见,SonarRunner 和 jsTestDriver只是进行代码分析,不显示任何单元测试。
【问题讨论】:
-
SonarQube 文档网站没有提到关于 js-test-driver 的任何内容。它只是说它将导入 js-test-driver 的报告。
-
谢谢。编辑了我的帖子。
-
我缺少任何插件吗?阅读这份报告需要什么插件?
标签: sonarqube sonar-runner sonarqube-4.5 js-test-driver