A word of praise for testsΒΆ

Tags: plone

broken down

Whit rightly says: Finally, a big shout out to Stefan Holek. Without ZopeTestCase(and stefan to impress upon people the proper way to use it), many of us might still be rubbing rocks together in a dark cave, sacrificing hours to the zope gods hitting reload.

Yesterday (and this night) I tried to modify the navigation tree. This has been made much cleaner with some zope3 view classes and adapters, though plugging it all together and figuring it all out took some doing.

The important thing: it took a lot of iteration. Try someting, see the result, try again, result again. And that a lot of times. Restarting zope instances like in the old days would have almost been prohibitive of the kind of change I had to do because the iterations would take way too much time. And you'd had to check quite a lot of things over and over again. Our development would be as delipidated as the railway car in the picture.

Tests are patient and will keep on checking what you've told them to check. I made a nice doctest, explaining what the desired result was and building up a navigation tree and descending down into it, all the while explaining what was to be displayed at each and every point. Including code that checked if it was correct.

Code a bit, run the tests, code a bit, run the tests. Get instant feedback. And if you build your tests step by step, you'll get instant positive feedback time and again every step of the way. "Yes, this new functionality works". "Yes, this is also good". Until you find an error and get to correct it. Only it is your friendly test mechanism that tells you instead of a disappointed customer :-)

blog comments powered by Disqus
 
vanrees.org logo

About me

My name is Reinout van Rees and I work a lot with Python (programming language) and Django (website framework). I live in The Netherlands and I'm happily married to Annie van Rees-Kooiman.

Weblog feeds

Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):