Project

General

Profile

Feature #91691

Updated by Tymoteusz Motylewski almost 4 years ago

It would be nice to get feedback about test code coverage when pushing a commit to gerrit. 
 I've played around with PCOV (https://github.com/krakjoe/pcov), and running unit tests with coverage enabled on my local machine took 46.63 seconds (23.74 seconds without coverage enabled), 
 Generating code coverage report in Clover XML format ... done [15.69 seconds] 
 Generating code coverage report in HTML format ... done [7.77 seconds] 

 Here is the config I've used: 
 <pre> 
 #Build/pcov.ini 
 pcov.enabled = 1 
 pcov.directory = typo3 
 pcov.exclude="~(vendor|Tests|Resources|Configuration|node_modules)~" 
 pcov.initial.files = 10000 
 memory_limit = 2G 
 </pre> 
 <pre> 
 php -c Build/pcov.ini vendor/phpunit/phpunit/phpunit -c vendor/typo3/testing-framework/Resources/Core/Build/UnitTests.xml --coverage-html 'reports/clover_html' --coverage-clover 'reports/clover.xml' 
 </pre> 


 We can either generate html coverage report ourselves or push the report to some external tool like https://coveralls.io/. 

 As a first step the report could be generated in the nightly build , later it could be added to bamboo patchset tests. 

 To have the most meaningful report we should combine coverage reports    from our parallel unit builds and functional tests. This could be achieved using phpunit/phpcov    (https://github.com/sebastianbergmann/phpcov): : 

 <pre> 
 phpunit --coverage-php build/cov/coverage-${component_name}.cov 

 php vendor/bin/phpcov.php merge --clover build/logs/clover.xml build/cov 
 </pre>

Back