Morning testing idea
As I stood up this morning, I had an idea in my head. It wasn’t a solution to a problem I’ve been thinking about, or anything, and it isn’t widely applicable either. But I just thought I should write it down.
When unit testing, one pattern is the Journalling Pattern (which is called “Log String” in the upcoming book on test-driven development), where you subclass your testee and keep a log of which methods are called and in what sequence. This pattern is a more light-weight alternative to Mock Objects and should be considered before venturing into the deep and dark mock forest.
Anyway, sometimes it is a requirement that the software should log stuff – especially with server software with lots of remote users, where the feedback of bugs is really lousy. My idea was that if you keep a log, you might consider to use it to test the internals of your code just as well. What I like about this is that you “reuse” an element of the code for testing purposes. (If you’re doing true test-driven development, you “have” to test the log, of course.)