Unit Testing Examples

Tom Verbeure tom_verbeure at hotmail.com
Mon Nov 17 12:10:32 EST 2003


Hello All,

so I'm now convinced that unit testing is really the way to go and I
want to add it to an existing project. The first thing that I find
out, is that, well, it's hard work. Harder than writing the real
functional code.

My application manipulates graphs. I first write the skeleton in
Python, then convert it to C++ for high performance (some graphs can
have millions of nodes.)
Up to now, I simply evaluated the validity of a graph by eye-balling
the results of toy problems. Obviously, this gets harder as the graphs
grow, so unit testing sounds like a good way to make sure I catch
mistakes early.

I'm not sure, though, at what level I have to write unit tests. It's
easy to write a tests that validates the consistency of a single node
of a graph, but the real complexity is, of course, in the interaction
of multiple nodes.

What I'm looking for is some examples, existing open source projects
that make heavy use of unit testing. I'd like to see a real life
example about how those tests are structured and how the complexity of
these tests expands from object level to system level.

Thanks,
Tom




More information about the Python-list mailing list