AllTests.php and pear run-tests
| From: | Christian Weiske | Date: | Mon, 02 Jul 2007 19:55:53 +0000 |
| Subject: | AllTests.php and pear run-tests | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-47149@lists.php.net to get a copy of this message | ||
Hello all and especially Greg,
Today I tried to create a pear-wide testsuite to get coverage reports about all packages that have
phpunit based unit tests.
My idea was first to dig through all the tests directories and add the single tests suites to a big
AllAllTests.php file in pear's cvs root. This method is not feasible, since all the test suites
of all packages need to be added by hand to this file.
PHPUnit allows to nest test suites by setting suites as sub-testsuites of a certain suite. So the
idea is to just do a glob('*/tests/AllTests.php') and we have all packages with
phpunit-compatible AllTests suite. Having this list we could easily add all those package-wide
suites to the pear-wide test suite dynamically.
The problem is that pear run-tests requires AllTest.php to have a class AllTests inside (better,
phpunit requires this if you don't pass a custom class name).
Having 100 classes named AllTests does not work when building a global test suite (class already
defined).
That why I propose that "pear run-tests -pu Package_Name" executes phpunit with the test
suite classname Package_Name_AllTests in AllTests.php.
All existing AllTests.php would need to get their classes renamed accordingly.
The benefit would be pear-wide code coverage analysis reports and a unified testing method for all
packages at once.
(It is possible to generate those coverage reports for each package, but they won't be
integrated into one single set of html files.)
--
Mit freundlichen Grüßen/Regards,
Christian Weiske