Re: Awfully crasy
| From: | Greg Beaver | Date: | Sat, 12 Nov 2005 15:29:35 +0000 |
| Subject: | Re: Awfully crasy | ||
| References: | 1 2 3 | Groups: | php.pear.qa |
| Request: | Send a blank email to pear-qa+get-3243@lists.php.net to get a copy of this message | ||
Christophe Gesché wrote:
Davey Shafik wrote:This is nice in theory, but in practice extremely difficult. Many packages interact with external elements such as databases, remote FTP/HTTP servers, and so on. Writing unit tests for these packages is arduous and often requires a re-design of the package to allow mock objects, or requires setting up a database and so on. It took me 4 times as long to write tests for PEAR 1.4 than it took to write the code for PEAR 1.4. In order to do this, I had to write code to simulate: - http connection/caching/download - connecting to xmlrpc - fake FTP connection - fake PEAR_Frontend for displaying output to the user - fake error handler for detecting errors - fake logger for detecting logging and so on. This took a really long time. Of course, in many cases, it also meant tests are not cross-platform (PEAR does a chmod() to files on unix, but not on windows, so logs of installation are different depending on the OS). Requiring tests requires that developers be extraordinarily patient and persistent, as it is neither sexy nor easy work to write good tests. All the same, there are tons of packages out there whose sole purpose is to grab input from variables populated by PHP and then spit out output (aka template packages, html/xml packages, etc.). These packages are REALLY easy to test, and it is fair to call developers who don't write them lazy slackers :) However, if you do, you also run the risk of starting a flame war, and that saps productivity away from development. It's a tough call. GregJust as a note, There was a discussion some weeks about allowing different test runners in PEAR than just the standard .phpt ones. Lets hope this bears some fruit :)Yes I would re explain my message. I think that 1° pear test foo would ALWAYS work in a STABLE package.