External Code Coverage¶
If you are already using an external service for continuous integration and would just like to use Scrutinizer's first class code review tools, you can also send us code coverage that was generated by an external service.
Configuration is a two step process. First, you need to tell Scrutinizer that you send code coverage information from an external service in your build config. Second, you also need to configure your external service to send the code coverage information to Scrutinizer.
Changes in Scrutinizer Configuration¶
tools: external_code_coverage: true
By default, Scrutinizer will wait 5 minutes for the code coverage information to arrive. If your test-suite runs longer than that, you can change the timeout:
tools: external_code_coverage: timeout: 600 # Timeout in seconds.
Merging Coverage Data¶
If you have split your tests across multiple runs, Scrutinizer also supports merging your test data, just set the
tools: external_code_coverage: runs: 2 # Scrutinizer will wait for two code coverage submissions
Changes in Third-Party Configuration¶
In addition to modifying your Scrutinizer configuration, you also need to change the build configuration of your external service to generate code coverage and then upload that code coverage information to Scrutinizer.
vendor/bin/phpunit --coverage-clover=coverage.clover wget https://scrutinizer-ci.com/ocular.phar php ocular.phar code-coverage:upload --access-token="your-token" --format=php-clover coverage.clover
--access-tokenoption. For private repositories, you can generate an access token on your profile page (https://scrutinizer-ci.com/profile/applications) - make sure to create it with
READaccess only. Furthermore you can add repository and revision parameters such as
pip install scrutinizer-ocular ocular --access-token "your-token" --data-file ".coverage" --config-file ".coveragerc"
For more information, view the Python setup instructions.
gem install scrutinizer-ocular
# At the very top of spec_helper.rb, test_helper.rb or equivalent require 'scrutinizer/ocular' Scrutinizer::Ocular.watch! # ... further test-setup
SCRUTINIZER_ACCESS_TOKEN=your-token build exec rspec spec
For more information, view the Ruby setup instructions.