[TIP] Speccer - Simple, specification driven testing tool

Juho Vepsäläinen bebraw at gmail.com
Tue Dec 28 11:22:29 PST 2010


I'm currently developing a little testing tool. You can find it at
https://github.com/bebraw/speccer . It contains basic setup.py and
instructions in case you want to give it a go. I have yet to upload it
to PyPI.

So why to write yet another testing tool? This tool aims to simplify
tests to some sort of acceptable minimum. It has some form of crude
DSL based on which it generates actual code using unittest. To get a
better idea, just look at the following test definition:

set up
    c = myclass.MyClass()

adds two and two
    c.add(2,2) == 4

fails adding int and string
    c.add(10, 'foo') raises TypeError

As you can see I ripped everything I could from it. It's pretty
readable (to me anyway) and quite fun/fast to write this sort of code.

I intend to develop the tool a bit further. I have considered adding
support for some other target languages (PHP, JS support would be
cool) as the test definition is quite generic. Some form of code
generation (get boilerplate that passes tests) might be cool too.

So why I'm writing this post? I guess it might be nice to get some
feedback from more experienced Python peeps. If you find the tool
useful, all the better. :)

Juho Vepsäläinen

More information about the testing-in-python mailing list