Feature #91691

Add code coverage report to bamboo build

Added by Tymoteusz Motylewski over 1 year ago. Updated 2 months ago.

Status:
Under Review
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2020-06-22
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

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:

#Build/pcov.ini
pcov.enabled = 1
pcov.directory = typo3
pcov.exclude="~(vendor|Tests|Resources|Configuration|node_modules)~" 
pcov.initial.files = 10000
memory_limit = 2G

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'

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):

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

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

Files

codecoverage.jpg (290 KB) codecoverage.jpg Łukasz Uznański, 2021-08-14 08:57
#1

Updated by Tymoteusz Motylewski over 1 year ago

  • Description updated (diff)
#3

Updated by Łukasz Uznański 2 months ago

Unit tests coverage raport

#4

Updated by Gerrit Code Review 2 months ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/70591

#5

Updated by Gerrit Code Review 2 months ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/70591

Also available in: Atom PDF