Closed k00ni closed 1 year ago
The idea is to persist code coverage data from multiple runs as PHP (using PHPUnit's --coverage-php
option, for instance) and then merge that PHP representation using this tool and generate HTML from the merged data, for instance.
This is shown here.
Thank you for your quick reply, but this issue is not completed.
I have problems understanding how to achieve the last part (... and generate HTML from the merged data
). As I wrote, I have a merged file /tmp/clover.xml
. It is the result of running phpcov merge --clover /tmp/clover.xml /tmp/coverage
.
I already checked the link you gave me, but I am either blind or not able to understand it. As far as I can tell, phpcov has three commands:
phpcov execute
- Executing a PHP script and generating code coverage in Clover XML format -- donephpcov merge
- Merging exported php-code-coverage objects stored in *.cov files -- donephpcov patch-coverage
- Patch Coverage (It doesn't seem to fit, because Git is involved and it prints something on the console)None of these seem to create a HTML representation when providing the merged /tmp/clover.xml
.
Answer: After taking a deep look into the code I found that you can use --html path
to achieve HTML reporting after the merge command finished.
Example:
phpcov merge --html ./test/coverage/html /tmp/coverage
I run multiple test suits and therefore have multiple coverage files, which I merge into one using https://github.com/sebastianbergmann/phpcov#merging-exported-php-code-coverage-objects-stored-in-cov-files:
Is there a way to turn
/tmp/clover.xml
into a HTML representation or console output or something else more readable than XML?Note: I checked https://github.com/daison12006013/clover-coverage-to-html already, but it doesn't run on PHP 8.1.
If not, any hints how to achieve that are highly appreciated. Thanks in advance.