I have a small PHP project that uses PHPUnit for unit tests and coverage. I would like to generate the coverage reports in cobertura XML format.
Is there any tool or plugin that I can use to achieve this?
Any help is appreciated..
In computer science, code coverage is a measure used to describe the degree to which the source code of a program is tested by a particular test suite. A program with high code coverage has been more thoroughly tested and has a lower chance of containing software bugs than a program with low code coverage.
The beStrictAboutChangesToGlobalState Attribute This attribute configures whether PHPUnit should mark a test as risky when global state is manipulated by the code under test (or the test code).
PHPUnit uses XML file for configuration. This configuration file can be added to your version control system so all developers get the same output. These settings will help you make sure your tests work the way you want.
Support for Cobertura format has just been merged to phpunit and phpcov, and it is available in phpunit 9.4
The report can be generated by invoking phpunit with this flag:
phpunit --coverage-cobertura=my-cobertura-coverage.xml
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With