Carlos make a very interesting point concerning my suprise that Flickr haven’t invested in functional testing:
…[not testing can incur] less upfront [costs] and more maintenance costs over time. As a startup (well, before they were acquired by Yahoo, anyway), this makes sense: the whole point of a startup is that you can do riskier things, and they guessed at some point that automatically testing anything but the most significant bits (smoke tests?) wasnt as important as getting code out the door, fast, and obssessively listening and reacting to user feedback. This probably required keeping insane levels of attention to detail and commitment, which is quite rare I might add, but a great part of what I attribute to their success.
That certainly seems to tally with how the Flickr team went about spending money during their early years (and software is nothing if not expensive) – they only spent money if needed. The problem with developing an application without testing in mind, is that it can make testing at any level other than functional very difficult without restructuring after the fact (whch by definition is harder without lower level tests).
It is certainly possible the Flickr team decided not to test due to the percieved cost of testing – I wonder how many PHP developers back when Flickr was developed were aware of the testing options out there? They certainly didn’t have Selenium, and I doubt FIT was up to much back then. Without such higher-level functional testing aids, the cost of developing in-house functional tools (or bringing in something expensive and complicated like Mercury) may well be prohibitive.
On the other hand, is the average PHP developer interested in testing? Take a look at the testing tools available to the large PHP community – then compare it to the wealth of tools and API’s available to Java. There seems to be nothing like the same demand amongst the PHP crowd for such tools. It may well be of course that PHP projects are on the whole smaller scale and less complex, and therefore have less need for higher-level testing tools.
I’d like to think that the fact that many PHP developers now seem to be trying out Rails (and by extention I expect to see them trying out Django if/when it gets more hype) is a sign that they realise being more rigorus in their development approach is important, and that a more advanced language will make it easier to embrace programming techniques such as OO (even if some of them do think it is insane 🙂 ). But the cynic in me still thinks most of them are being attracted by great Ajax support and the percieved benifits of scaffolding.
2 Responses to “Do PHP programmers care about testing?”
Some PHP programmers care about testing. Does the average PHP programmer care about automated testing? On average, probably not. Does the average Java or Ruby programmer care about automated testing? I dont know what the average is but again, probably not.
If youre looking for automated testing in PHP check out SimpleTest. It has Mock Objects and Acceptance testing through a web tester.
http://www.lastcraft.com/simple_test.php.
I recently left a Java XP team that did heavy testing, and went to a startup using PHP, and basically stopped writing tests. In java land we used a lot of frameworks and libraries, J2EE based with Struts, JSP, and with that came a lot of good testing patterns and frameworks (mock ejbs, struts action unit tests, httpunit/jwebunit). It just seems less structured in PHP, the testing patterns aren’t developed yet, or if they are, they aren’t widely known.