I haven't gotten around to reading much of the XP material (well a little online), but with pywinauto I finally started to do some unit tests. Even though my coverage is still quite minimal - I don't have even one test per method yet (and some require more then that!) - I have found that it has helped me to find numerous bugs that I hadn't known about - or wouldn't have known about until I released!
I end up running the tests or at least part of the tests frequently. I am not quite to the point where I am first creating a test for the functionality that I have yet to code.
I now understand why tests make refactoring easy - you change your code until you feel it is refrigerator ready - then you run your tests and make sure that they run like they did before you ripped out that gangrenous rotting piece of code that you smelled last week. :-)
The next thing that I need to do is to add the examples to the tests - that way I will have some 'integration' tests along with all the unit tests. :-)
I feel a release coming soon - and then I think I may need to take it easy for a little while.
I have to agree with you, tests and agile programming methodologies is definitely the way to go. Tests are the micro-programs that show you you're making progress. Code-Test-Code-Test. It's very much like Lisp's REPL. Whever I write python module, the first thing I do is create a tests directory and add the "test" command to setup.py. I found this little recipe at
ReplyDeletehttp://sevenroot.org/dlc/2002/11/using-distutils/.
Very nice.