2
votes

I'm using Sonar 3.2.1 (sonar-runner 2.0) with PHP Plugin 1.1 and PHPUnit 3.7.7 using phpunit.xml configuration. The problem is that my tests run well, but no info about them appears in the Dashboard ("Code coverage" widget): only "Code coverage" section exists, but not "Unit test success" section. Only if I set sonar.tests property in sonar-project.properties file directly to my test folders, the "Unit test success" section will appear, with [root] path in details for each test file... Please, help me to avoid using sonar.tests property and correctlly get information about test in Dashboard and in Projects list.

This is output of the PHPUnit Sensor in all cases (with/without sonar.tests property):

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

1 Answers

0
votes

For information, discussion is happening here: http://sonar.15.n6.nabble.com/PHPUnit-tests-run-well-Sonar-report-missed-tt5004070.html

I'll update the answer when the problem is sorted out.