One of the things I like about GothPy is that lots of the people in the group enjoy writing code in their spare time, and like to share with us what they’re up to.
A little while back, Olof came up with this little tool, PyTDDmon, which is to help you when you’re doing TDD. Instead of your running your tests by hand, PyTDDmon sits in the background and runs them for you. When they are green, it has a little green blob, when they are red, it tells you how many are failing, and clicking on it gives you the stacktrace. Olof put together a screencast to show how it works.
Following Geoff’s presentation of PyUseCase at GothPy in December, he and Olof started to discuss whether it could be used to test PyTDDmon. Since it’s using the GUI library Tkinter instead of pyGTK, it didn’t look all that straightforward.
Of course, Olof developed the app using TDD in the first place, (definite own dog food eating going on!), and his unit tests have about 48% statement coverage. The parts with least coverage are GUI-related, so there seemed to be scope to improve matters by adding tests via the GUI.
Geoff sat down a few days ago with a branch of the PyTDDmon code, started trying to generalize PyUseCase to work with Tkinter, and to write some tests for PyTDDmon. (Geoff also likes writing code in his spare time 🙂
As I write, he’s just checking in his changes and a new suite of tests for PyTDDmon that use the new, improved PyUseCase, with (basic) Tkinter support! He says the hardest part was understanding Tkinter, and after a spot of refactoring, only an extra couple of hundred lines of code were needed to support it.
Subsequently adding tests for PyTDDmon was very easy (Geoff wrote most of them while I made biscuits with the children this afternoon 🙂 All he had to do to Olof’s code was assign names to some of the widgets, and sort out a problem with closing a window. (There was a listener for a mouse click that would destroy the window, before other listeners got a chance to do anything, such as record the click in a use case log…)
So now the statement coverage of the PyTDDmon tests is at 98%. I look forward to future, equally productive GothPy meetings and discussions!
OlofB says:
I had missed this blog post until now! How fun to read about the development of Tkinter-support for PyUseCase and the pyTDDmon-branch with TextTest’s.
I have yet to install/test these things out, but I am looking forward to it!
(TextTest is a really impressive system. Is there a Programmers Guide book coming? I think it would spread TextTest to a new public..)
2010-01-20, 23:10OlofB says:
BTW – do you regard the case-ing of pyTDDmon to be non-pythonic? Is PyTDDmon a more pythonic name in your opinion? 🙂
2010-01-20, 23:11Emily Bache says:
I don’t think either PyTDDmon or pyTDDmon is more pythonic, I guess Geoff chose the case PyUseCase and I was just being consistent with that.
As for a book, I’m sure we’ll write one some day. At present, it’s not top of our priority list. Books are a lot of work, and we have small children, and biscuits to bake!
2010-01-23, 20:40OlofB says:
pyTDDmon has moved! 🙂
New home on bitbucket
2011-02-17, 07:59