我正在使用带有 PHP 插件 1.1 的 Sonar 3.2.1 (sonar-runner 2.0) 和使用 phpunit.xml 配置的 PHPUnit 3.7.7。问题是我的测试运行良好,但仪表板中没有关于它们的信息(“代码覆盖率”小部件):仅存在“代码覆盖率”部分,但不存在“单元测试成功”部分。只有当我将sonar.tests
sonar-project.properties 文件中的属性直接设置到我的测试文件夹时,才会出现“单元测试成功”部分,其中包含[root]
每个测试文件的详细路径...请帮助我避免使用sonar.tests
属性并正确获取有关仪表板和项目列表中的测试的信息。
这是 PHPUnit Sensor 在所有情况下的输出(有/无
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