【问题标题】:Why Sonar dashboard missed PHPUnit tests that run?为什么 Sonar 仪表板错过了运行的 PHPUnit 测试?
【发布时间】:2012-10-05 23:53:59
【问题描述】:

我将 Sonar 3.2.1 (sonar-runner 2.0) 与 PHP 一起使用 插件 1.1 和 PHPUnit 3.7.7 使用 phpunit.xml 配置。 问题是我的测试运行良好,但没有出现关于它们的信息 在仪表板(“代码覆盖率”小部件)中:仅存在“代码覆盖率”部分,但 不是“单元测试成功”部分。 仅当我将 sonar-project.properties 文件中的 sonar.tests 属性直接设置为我的测试时 文件夹,“单元测试成功”部分将出现,[root] 路径在 每个测试文件的详细信息... 请帮助我避免使用 sonar.tests 属性并正确获取 仪表板和项目列表中有关测试的信息。

这是 PHPUnit 传感器在所有情况下的输出(有/没有 sonar.tests 属性):

18:12:05.850 INFO  p.PhasesTimeProfiler - Sensor PHPUnit Sensor...
18:12:05.851 INFO  ractPhpConfiguration - Report file for: phpunit :
/project/src/.sonar/target/logs/phpunit.xml
18:12:05.851 INFO  PhpUnitConfiguration - Report file for: phpunit :
/project/src/.sonar/target/logs/phpunit.coverage.xml
18:12:05.851 INFO  .AbstractPhpExecutor - Executing PHPUnit with
command 'phpunit --configuration=../app/phpunit.xml
--log-junit=/project/src/.sonar/target/logs/phpunit.xml
--coverage-clover=/project/src/.sonar/target/logs/phpunit.coverage.xml'
18:12:05.851 INFO  .u.c.CommandExecutor - Executing command: phpunit
--configuration=../app/phpunit.xml
--log-junit=/project/src/.sonar/target/logs/phpunit.xml
--coverage-clover=/project/src/.sonar/target/logs/phpunit.coverage.xml
18:12:06.076 INFO  .u.c.CommandExecutor - PHPUnit 3.7.7 by Sebastian Bergmann.
18:12:06.076 INFO  .u.c.CommandExecutor -
18:12:06.076 INFO  .u.c.CommandExecutor - Configuration read from
/project/app/phpunit.xml
18:12:06.076 INFO  .u.c.CommandExecutor -
18:12:09.456 INFO  .u.c.CommandExecutor - .F
18:12:09.456 INFO  .u.c.CommandExecutor -
18:12:09.456 INFO  .u.c.CommandExecutor - Time: 4 seconds, Memory: 24.50Mb
18:12:09.456 INFO  .u.c.CommandExecutor -
18:12:09.456 INFO  .u.c.CommandExecutor - There was 1 failure:
18:12:09.457 INFO  .u.c.CommandExecutor -
18:12:09.457 INFO  .u.c.CommandExecutor - 1)
Acme\DemoBundle\Tests\Controller\DefaultControllerTest::testIndex
18:12:09.457 INFO  .u.c.CommandExecutor - Failed asserting that false is true.
18:12:09.457 INFO  .u.c.CommandExecutor -
18:12:09.457 INFO  .u.c.CommandExecutor -
/project/src/Acme/DemoBundle/Tests/Controller/DefaultControllerTest.php:15
18:12:09.458 INFO  .u.c.CommandExecutor -
                                        FAILURES!
                                        Tests: 2, Assertions: 2, Failures: 1.

18:12:10.213 INFO  .u.c.CommandExecutor - Generating code coverage
report in Clover XML format ... done
18:12:10.256 INFO  .AbstractPhpExecutor - PHPUnit succeeded with
returned code '1'.
18:12:10.256 INFO  ractPhpConfiguration - Report file for: phpunit :
/project/src/.sonar/target/logs/phpunit.xml
18:12:10.256 INFO  .PhpUnitResultParser - Parsing file:
/project/src/.sonar/target/logs/phpunit.xml
18:12:10.280 INFO  PhpUnitConfiguration - Report file for: phpunit :
/project/src/.sonar/target/logs/phpunit.coverage.xml
18:12:10.280 INFO  CoverageResultParser - Parsing file:
/project/src/.sonar/target/logs/phpunit.coverage.xml
18:12:10.754 INFO  p.PhasesTimeProfiler - Sensor PHPUnit Sensor done: 4904 ms

【问题讨论】:

    标签: report phpunit sonarqube dashboard sonar-runner


    【解决方案1】:

    有关信息,请在此处进行讨论:http://sonar.15.n6.nabble.com/PHPUnit-tests-run-well-Sonar-report-missed-tt5004070.html

    问题解决后我会更新答案。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-04-18
      • 2015-03-22
      • 2019-05-05
      • 1970-01-01
      • 2021-10-25
      • 1970-01-01
      • 2011-03-28
      相关资源
      最近更新 更多