Six weeks off.. and in praise of testing.

I see to my dismay that I havent blogged for about six weeks. Here are my excuses. Im back now, though, with a major new project.

Firstly, there was the book. Its getting quite good comments on the relevant forums.

Secondly, I was on holiday for two weeks (but thats not really an excuse. Venice is full of internet cafes these days.

Thirdly Ive been working hard on my latest project, Alternative Worlds, an emergency response exercise website. (See here for details.) This is now ready and has been demonstrated to some potential clients: I expect it will take up a lot of time over the next few months!

It has been a major project, and very demanding to get the right level of quality built in. In particular, Ive built in an extensive system of tests. Thse include:
– the programme has a dynamic menu and a dynamic checklist. Every possible page called by these two is automatically end to end tested – ie called up over the internet to see if it works. The testing process takes about a minute and the number of errors has steadily come down until now its zero. (Well, not quite! We had to take out the test of the log out page, since testing it logged the system out of itself in the middle of the test run… plus we had to take out the test page itself, to prevent endless loops…)
– when we uploaded the programme from the development servers to the first production server, all sorts of bizarre things happened. Some were due to differences in PHP versions. The oddest, perhaps was that many of the MYSQL tables rely on having an auto-incrementing ID field. That is, each record needs a unique ID number, and you can set MySQL to provide a unique new number automatically each time you make a new entry. The database copied over perfectly, except that the auto-increment fields werent set as such. This is an odd error, becuase you can test the thing once and it works (the new ID number comes out as 0) but it then fails when you add a second entry (which also tries to have a duplicate ID of 0). The remedy is simple: write a short test that looks at each MySQL table to check that it is auto-incrementing (and sets it to do that if it isnt).

Theres a lot to be said for a good test suite if you want to sleep well at night. Each time we find an error, we build in a new test. The result is that, in five minutes a day, we can do as much testing as would take a human a whole morning, if you could find anyone who would do such a boring job.

Its interesting how the trivia take so long. Setting up code documentation, for instance, even using PHPDoc, is remarkably time-consuming. The fun bits, actually writing intelligent web pages, seem to be relatively easy compared to the rest! But I suspect that its getting these trivia right and providing a rock-solid product (as far as anyhting on the internet is rock solid) that really makes the difference.

Leave a Reply

Your email address will not be published. Required fields are marked *