为什么Sonar仪表板错过了运行的PHPUnit测试?

时间:2012-10-15 23:09:40

标签: report phpunit sonarqube dashboard sonar-runner

我正在使用带有PHP的Sonar 3.2.1(声纳 - 跑步者2.0) 插件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

1 个答案:

答案 0 :(得分:0)

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

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