We have our projects in Bitbucket Repositories and we are using Bitbucket Pipelines for using SonarCloud to scan and validate our code but we are having some trouble with Code Coverage.
As you can see, everything is fine but we have 0.0% Coverage.
We have developed our unit tests and generating reports correctly but no chance to make it work with SonarCloud.
Here’s my .yaml file:
image: williamyeh/ansible:ubuntu18.04 pipelines: custom: ... pull-requests: '**': - step: name: Run tests and Generate coverage reports image: epcallan/php7-testing-phpunit:7.2-phpunit7 caches: - composer script: - composer install --no-progress --no-suggest - vendor/bin/phpunit - step: name: Sonar check quality code script: - pipe: sonarsource/sonarcloud-scan:1.0.0 variables: EXTRA_ARGS: -Dsonar.projectDescription=\"Project with sonarcloud-scan pipe\" -Dsonar.eslint.reportPaths=\"report.json\" -Dsonar.php.coverage.reportPaths=\"codeCoverage/coverage.xml\" -Dsonar.php.tests.reportPath=\"codeCoverage/test.xml\" SONAR_SCANNER_OPTS: -Xmx512m DEBUG: "false"
As you can see, I’m loading an image that has phpunit and Xdebug (because with other images was throwing an Error: No code coverage driver is available while doing the
With this image the Bitbucket Pipeline did run
vendor/bin/phpunit but with really different results as in my Localhost.
Anyone know how to make this work?