Ian Bicking: the old part of his blog

DataTest

After writing about unittest a while ago, I got it into my mind that I wanted to make something better, especially to be friendlier to test-driven development. Several other projects were recommended in the comments, and I spent quite a while trying to use the Zope tester, but ultimately I found it unsatisfying. (Most of the time I couldn't get the Zope tester to find any of my tests, and when I did manage it I didn't understand why)

To me the problem was that not enough was being delegated to the TestCase instances, so that people couldn't override enough on their own. This included the code to find and run tests.

Anyway, after agonizing over the design for far too long, I've finally got something that feels (kind of) right to me: DataTest (download). The README describes the changes. Some of the features: (intended to be) compatible with unittest; tests can have multiple parameters, and each combination of parameters is its own selectable test instance; a test loader/runner that actively seeks out tests, and allows intelligent selection of tests. I have some other ideas for the tester as well (several of which are in other frameworks, but are actually easier than they seem at first).

I haven't had a chance to actually use the tester for useful stuff yet. I plan to convert my FormEncode tests first, as that was a driving project (since it involves lots of data input and output).

I'm very interested in comments or suggestions. I'm not confident of the design (even though I've already refactored the design several times), or of how well it addresses all the issues with test suites. But I still like it, and I think the code is relatively simple all considering, which is a good sign.

Created 27 Feb '04
Modified 14 Dec '04

Comments:

"""tests can have multiple parameters, and each combination of parameters is its own selectable test instance;"""

Hmm, this sounds like a good feature for my Testipy framework...
# Hans Nowak