【问题标题】:How to tell Sonar to use my surefire reports for unit test results如何告诉 Sonar 使用我的万无一失的报告来获取单元测试结果
【发布时间】:2013-03-24 03:31:21
【问题描述】:

我们有一个 Jenkins 作业,其中包含一堆 javascript 文件。我们通过 grunt 构建我们的项目,并在构建结束时运行 JSCover 来运行我们的单元测试并收集代码覆盖率。这一切都有效。我们得到了一个不错的 LCOV 文件,我们在 target/surefire-reports/ 目录中得到了一堆 TEST-*.xml。

Sonar 显示代码覆盖率结果,但不显示通过/失败甚至执行的测试数量。

如何让声纳使用万无一失的报告? 我以为通过设置这个属性,它会消耗它,但没有爱:

sonar.surefire.reportsPath=target/surefire-reports

这是我的项目属性文件:

# project metadata (required)
sonar.projectKey=pure.cloud.browser.app
sonar.projectName=Pure Cloud Browser App
sonar.projectVersion=1.0
# path to source directories (required)
sonar.sources=src
sonar.exclusions=js/lib/**,js/test/lib/**,js/test/tools/**
# The value of the property must be the key of the language.
sonar.language=js

# Advanced parameters
sonar.surefire.reportsPath=target/surefire-reports
sonar.javascript.lcov.reportPath=target/test-coverage/jscover.lcov
sonar.dynamicAnalysis=reuseReports

感谢 Fabrice 在我之前的问题中向我推荐以下链接: https://github.com/SonarSource/sonar-examples/tree/master/projects/languages/javascript/javascript-sonar-runner-JsTestDriver 但我找不到方法告诉 Sonar 以某种方式显示存储在 surefire-reports 目录中的单元测试结果(测试数、失败数等)。

有什么想法吗?

【问题讨论】:

  • 在 Sonar Javascript 1.3 中,“sonar.surefire.reportsPath”已被“sonar.javascript.jstestdriver.reportsPath”替换:你试过了吗?
  • 你是对的!我不知道它被替换了。它就像一个魅力。再次感谢您,Fabrice!
  • 好的,我会添加这个作为答案,以便您可以为其他用户验证它。

标签: javascript sonarqube surefire


【解决方案1】:

在 Sonar Javascript 1.3 中,“sonar.surefire.reportsPath”已替换为“sonar.javascript.jstestdriver.reportsPath”。

【讨论】:

  • 由于此属性不再存在,目前如何将测试报告上传到 Sonar 的正确方法是什么?
【解决方案2】:

此属性不再存在。见http://jira.codehaus.org/browse/SONARJS-163

【讨论】:

    猜你喜欢
    • 2016-09-07
    • 2012-03-08
    • 1970-01-01
    • 2020-11-21
    • 1970-01-01
    • 2019-02-17
    • 1970-01-01
    • 2016-05-03
    • 2016-08-05
    相关资源
    最近更新 更多