2
我使用Sonar 3.2.1(sonar-runner 2.0)和PHP Plugin 1.1和PHPUnit 3.7.7使用phpunit.xml配置。 問題是我的測試運行良好,但沒有關於它們的信息在儀表板(「代碼覆蓋」小部件)中出現 :僅存在「代碼覆蓋率」部分,但 不是「單元測試成功」部分。 只有當我設置sonar-project.properties sonar.tests
屬性文件直接到我的測試 文件夾,在「單元測試成功」部分將出現,與[root]
路徑 細節每個測試文件... 請幫我避免使用sonar.tests
屬性,並在儀表板和項目列表中正確地獲取有關測試的信息 。爲什麼Sonar儀表板錯過了運行的PHPUnit測試?
這是在所有情況下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