Earlier tonight, Jimmy Berry posted a plea for the Drupal community to clean up their messes in terms of testing. Since Jimmy did a whole bunch of the heavy lifting involved in getting the SimpleTest framework ready to commit to core, a major milestone in Drupal's development, we'd do well to listen to his words and his frustrations when he sees all of his hard work falling apart due to neglect.
SimpleTest has only been in core for a month now, and already we've managed to break more than half the tests. This is a big problem. :\
In order for our community to embrace testing, we're required to bring several hundred people who've never written a test before in their lives (and might not even have heard of automated testing until heard some Drupal people talking about it) up to speed on what testing is, why it's a good thing, and how to do it.
But every time there's a bug in the testing framework, and every time an existing core test fails to run, this serves to completely destroy developers' confidence. If we're lucky, these people will go work on other things for a little while, and then check back periodically to see if things have been sorted things out yet. If we're unlucky, they start to develop animosity and resentment about the very idea of testing, and then start to distance themselves from doing development and encourage others to as well. Either way, the end result is stalling development on D7, and fewer people to spread the work around of writing further tests.
So how can someone concerned about the state of D7 development help?
- Fix the existing tests so that they all pass. This is the #1 priority. Without this, our testing framework is basically useless. If a developer new to testing can't trust that what's there now is working, how can they possibly know if the test they just wrote breaks because they did something wrong, or because something was broken before they got there? This can be a good place to start if you're new to testing, as in the process of your detective work you'll often learn a lot, very quickly.
- For the love of all that's good in the world, KEEP the tests working once they pass. Several efforts could help with this, including http://testing.drupal.org (check the Drupaltestbed issue queue for places to jump in), which does automated patch testing as they're uploaded to drupal.org, efforts around improving the performance of the testing framework so that an entire battery of tests can run in minutes rather than lots of minutes ;), etc. You can also do your part by not marking patches RTBC until they a) have tests written and b) you've confirmed they don't break existing tests.
- Help get the API differences resolved between 5.x/6.x and 7.x SimpleTest module. That'd be this sucker: http://drupal.org/node/241156. If we get this problem fixed, then a) the majority of developers who are working on 5.x/6.x websites can utilize testing for their own modules in code they're familiar with, and not have to re-learn stuff to apply that knowledge to core, and b) we can "back-port" many tests that currently aren't there for earlier versions of Drupal. Oh, and c) we don't need to maintain two versions of testing documentation, which is a definite plus, considering we haven't historically done a good job of even maintaining one set of testing documentation. ;) Speaking of which...
- Help with documentation. Especially if you're new to testing, lend your feedback to the in-progress docs at http://groups.drupal.org/node/11020 and tell us where you're getting stuck so we can further improve them. catch is doing a great job of this.
- Figure out standards and best practices, and update the tests to reflect them. Newbies cling to standards because when they start out at least they're going to be in copy/paste/modify mode rather than "Let me whip up a test for that" mode. Keeping our test files consistent and well-written will make them easier for people to understand and lower the learning curve tremendously. Another great place for people new to testing to help out -- clean-up patches for tests. Helps keep the Drupal garden looking fresh and tidy, and also exposes you to the anatomy of tests in a very hands-on way.
SimpleTest has the very real potential to crank the Drupal development community's productivity up several notches, but only if we all pitch in. Hope to see you in the queue and at http://groups.drupal.org/unit-testing!