am:: The most embarassing thing about having what you think are decent unit tests is when a bug report comes in that makes you realise you missed something pretty obvious. Anyone who has downloaded the 2002-07-04 build of KwikWiki will have noticed that it can't create new pages. Oops.
Mamading Ceesay sent me the bug report, complete with stacktrace. I follow the stacktrace and get to a line of code with a comment that says "assume file always exists." But files that haven't been created can't be assumed to exist.
It turns out that whilst I was fixing a bug in the reverse file index code (words weren't being removed from the index when were removed from pages) I injected this bug in the page creation code by making it try to open the pre-existing version of every page it tries to save. Mea culpa.
It's a fairly easy bug to fix but I'm trying to adhere fairly closely to XP principles in all my projects. So I now have to write a unit test that exposes it. Then and only then can I fix the bug.
In other news
I really need to get HttpUnit working as part of my build. The alternative to running tests in the app server would be to decouple more of my code from servlet technology so that they can be tested in isolation.
Barring extreme laziness I shall be going to the XP Tuesday Club this evening. A whole bunch of people from Thoughtworks are coming over so it ought to be interesting.
pm (or rather middle of the night/early morning next day):: The trivial bug turned out to be more trouble than I'd anticipated. Luckily the test I'd written failed with my quick fix. So I didn't have the embarassment of annoucing it was fixed and then saying sorry when I realised the problem was more subtle than I'd anticipated. In the end I wrote a proper solution on the tube whilst I was heading to the XP Tuesday Club.
I bumped into Martin Fowler and the rest of the Thoughtworks group on the way to XTC. They, and everyone else at XTC, were very friendly. Especially considering that this was my first visit.
It was very unstructured and laid back but I enjoyed it immensely. I shall be back.
And of course I put out a new release of KwikWiki.