Unit Testing And Coverage With Phing

If we are to do unit testing, then it would be nice to have a simple way to run all the tests at once. And seeing the results in a command line is fine, but it would be nice to be able to generate some pretty reports we could view in a browser. And running coverage tools from the command line to see exactly what we’re testing is fine, but it would be nice to be able to generate coverage reports I could view in a browser. It would be nice to be able to do all these things with one simple command.

The command: phing.

The build file.

If you’re familiar with Ant for Java, phing is functionally identical to ant. With a very simple build script, we can run all the unit tests, and generate test result reports and coverage reports in HTML automatically. Then we can fire up my browser and see if any tests failed, or whether we need new tests.

The following are examples of test results reports and coverage reports.

Phing currently requires PHPUnit for unit testing and xdebug for coverage. You must write your own tasks to use other frameworks such as SimpleTest.

pox-php/unit_testing_coverage.txt · Last modified: 2010/05/09 19:49 by gerard
 
 
© 2010 Straylightrun.net under Creative Commons Attribution
Green hosting by Dreamhost.com | Powered by DokuWiki