Code Coverage tools for PHP [closed]

2019-01-10 17:37发布

问题:

Is there any code coverage tool available for PHP? I wish to check the code coverage of my code and API's written in PHP, but have not been able to lay my hands on any code coverage tool for PHP, as it is more of a server side language and dynamic in nature.

Does anyone know of a method by which code coverage for PHP can be executed?

回答1:

xdebug has Code Coverage Analysis.

Check this chapter of the PHPUnit Manual



回答2:

See our PHP Test Coverage tool from Semantic Designs:

http://www.semanticdesigns.com/Products/TestCoverage/PHPTestCoverage.html

Very low overhead, handles huge systems of files, intuitive GUI showing coverage on specific files, and generated report with coverage breakdown at method, class and package levels.

Best of all, no requirement to install anything in the system being tested. No need for xdebug, etc., which means you don't have to argue with the sysadmin to do your testing.

You can use it with PHPUnit to get unit-test driven coverage. Or you can use it on your website to collect coverage from any functional testing approach/tools you may have.



回答3:

Using Xdebug in combination with PHPUnit can give you code coverage analysis.



回答4:

Spike PHPCoverage. Both SimpleTest and PHPUnit can easily be integrated with it, although PHPUnits support is there out-of-the-box.



回答5:

Zend Studio ships with code coverage tools out the box.



回答6:

Xdebug can do code coverage reporting, and Phing, a build utility, can automate running coverage reports (http://devzone.zend.com/article/2955).