【问题标题】:unable to import Javascript test results to sonar qube无法将 Javascript 测试结果导入 sonarqube
【发布时间】:2016-01-21 01:44:25
【问题描述】:

我已经使用了这个属性并且报告是 XML 格式`JavaScript 单元结果没有导入到声纳仪表板。

project.home=..\\..\\PeriodDataFrontEnd
bevo-web-module.sonar.javascript.jstestdriver.reportsPath=.
bevo-web-module.sonar.projectBaseDir=.\\bevo-web\\src`

Sensor JavaScriptSquidSensor done: 493293 ms
10:45:51.310 INFO  - Sensor JsTestDriverSensor...
10:45:51.311 INFO  - Parsing Unit Test run results in Surefire format from folder D:\workspace\PeriodDataFrontEnd\bevo-web\src\.
10:45:51.455 WARN  - Test result will not be saved for test class "0.2403 (Windows 7 0.0.0).Given the container controller", because SonarQube associated resource has not been found using file name: "0\2403 (Windows 7 0\0\0)\Given the container controller.js"
10:45:51.576 WARN  - Test result will not be saved for test class "0.2403 (Windows 7 0.0.0).Given the container nav controller", because SonarQube associated resource has not been found using file name: "0\2403 (Windows 7 0\0\0)\Given the container nav controller.js"
10:45:51.688 WARN  - Test result will not be saved for test class "0.2403 (Windows 7 0.0.0).Given the browser has received JSON from the server when converting the JSON to a Page instance", because SonarQube associated resource has not been found using file name: "0\2403 (Windows 7 0\0\0)\Given the browser has received JSON from the server when converting the JSON to a Page instance.js"
10:45:51.805 WARN  - Test result will not be saved for test class "0.2403 (Windows 7 0.0.0).Given the page controller", because SonarQube associated resource has not been found using file name: "0\2403 (Windows 7 0\0\0)\Given the page controller.js"

在此处输入代码。

【问题讨论】:

  • 产生此错误的代码是什么?

标签: javascript sonarqube


【解决方案1】:

从日志中给出的信息我们可以推断,您提供的 XML 报告不遵循 JavaScript 插件支持的格式:Test result will not be saved for test class "0.2403 (Windows 7 0.0.0).Given the container controller", because SonarQube associated resource has not been found using file name: "0\2403 (Windows 7 0\0\0)\Given the container controller.js"

一些解释:

  • 为了将测试执行信息与测试文件相关联,JavaScript 插件需要具有测试文件的路径。该插件从 xml 测试报告中检索此信息,并且仅支持 js-test-driver xml 格式。
  • 从您提供的日志中,我们可以清楚地看到插件在期望文件路径的位置找到了无法用于检索测试文件的其他内容。

更多细节请参考这个文档页面,希望够清楚:http://docs.sonarqube.org/display/SONAR/Unit+Test+results+import

【讨论】:

  • 如果我给出确切的测试结果路径,我会收到此错误:解析单元测试运行结果以 Surefire 格式从文件夹 D:\workspace\PeriodDataFrontEnd\bevo-web\src\test-results.xml 11 :12:44.889 WARN - 未找到报告路径:D:\workspace\PeriodDataFrontEnd\bevo-web\src\test-results.xml 11:12:44.889 WARN - 不会保存单元测试信息,因为没有单元测试报告在给定目录中找到:{}D:\workspace\PeriodDataFrontEnd\bevo-web\src\test-results.xml
  • 我想知道junit XML测试结果格式和jstest驱动XML测试结果格式有什么不同
  • @lakshman 如日志所示和属性描述,包含 xml 报告的 目录 的路径应该不是 xml 文件的路径
  • 如果我给出包含 xml 文件的目录的路径,它也显示相同的错误: Parsing Unit Test run results in Surefire format from folder D:\workspace\PeriodDataFrontEnd\bevo-web\src 12:49: 33.824 WARN - 没有单元测试信息将被保存,因为在给定目录中没有找到单元测试报告:{}D:\workspace\PeriodDataFrontEnd\bevo-web\src
猜你喜欢
  • 2018-04-03
  • 2021-03-03
  • 2020-04-07
  • 1970-01-01
  • 1970-01-01
  • 2022-01-23
  • 2015-08-08
  • 2020-01-09
  • 1970-01-01
相关资源
最近更新 更多