|laziness, impatience, and hubris|
Re: Creating a co-operative framework for testingby Anonymous Monk
|on Oct 27, 2006 at 20:02 UTC||Need Help??|
I addressed this a bit in my YAPC talk this year, "The Reluctant Web Tester". I worked1 at Yahoo! Global Search at the time; most of Yahoo!'s web development is in PHP (Rasmus himself works for us), and there's a lot of time pressure to get features in and get bugs fixed fast. Developers tend to not have a lot of spare cycles.
PHP itself has a pretty decent testing package, but it's more like Test::Class than Test::More: you create a class to do the testing, lots of setup, etc. So we didn't get much in the way of buy-in.
My job was to build tools to get the programmers doing tests on the search platform, across a large number of international sites. They key was Keeping It Trivial To Do. I put together a Perl application called simple_scan (available as App::SimpleScan on CPAN) that took a URL, a regex, and a 'Y' or 'N' as its input; it then generated a Test::More-based Perl program that actually did the testing.
This was the first bar: no writing programs to write a test. The second bar was, for instance, running 20 queries against 20+ sites. Obviously cut-n-pasting 20 identical tests was unappealing, and I wanted to stay away from the idea that you were writing a program. So I came up with the idea of doing combinatorial substitution: define a variable that has the servers you want to test, and another one which has the queries you want to run, and simple_scan does all the work of generating the unique combinations. So 3 lines of input can now generate 400+ tests, all of which are monitored via the standard TAP tools.
The lesson of all this is to make sure that you provide testing in a way that is compatible with the goals of the programmer on the ground: if a programmer finds it really easy to write and run tests, he or she will write them. If there's any friction between "I should test this" and "test is running", you'll find that there are no tests.
The other lesson is that you don't have to make them write Perl to take advantage of the Perl testing tools.
1 I'm working on development tools now; simple_scan's worked out so well that I ran out of things to do for Search!