Some more thoughts on tests: It’s going to be a rare bug which is not local
to some specific method, and anyway it’s hard to write meaninful high-level
Another benefit I see of writing method-level tests is that it encourages
us to write losely-coupled classes. Easy-to-test classes are going to have
fewer depencencies and will use interfaces more—which are things we should
aim for when possible.
If you look at the tests which are in the trunk now, you’l see that I’m
testing at a very low level—but, since these tests pass, I’m pretty
confident that the classes being tested work properly.
One of the things I plan to do as part of my big model-view refactoring
project is to write tests for the model classes…
I think that you could write tests for many of the methods in the Jabber
server and client classes. One way to test a class which depends on other
classes is to create “mock” classes which exhibit the behavior you need.
This is something I haven’t done myself yet, though.