Code coverage for PHP - why not?
By Tomas Mysik on Feb 24, 2009
After a few days, we would like to inform you that code coverage for PHP has been added to the NetBeans IDE.
Thanks to PHPUnit (version 3.3 or newer required) we are able to provide code coverage for PHP files in a similar way as for Ruby or Python. And how it works? Well, follow these simple steps to see how "stable" your code is ;)
Note: In order to have the same functionality as shown here, be sure that you use the development version of NetBeans.
First of all, you have to enable code coverage for your project:
Then, just open the Code Coverage Report (from the same menu, item Show Report...):
As we can see, we don't have any results yet - it's correct, we haven't run our unit tests yet. Fortunately, we can run all the tests directly from the Report window, using Run All Tests button. The result could look like this:
Finally, if you then open any of these "covered" files, you will immediately see which lines of your code are well tested and which ones need more attention:
It would be great if you could test it and let us know if you find any error.
That's all for today, thanks for reading and we hope you enjoy this great new feature of PHP support in NetBeans!