The 9th level of indirection

time to read 3 min | 469 words

I’m having fun using Fitnesse to test my code, but I just got an exception from the bottom of the stack on one of my Fit tests, and I started to think about just how many layers I’m using there. In order to be able to complete the tests I want to write (business logic only, mainly), I’m going to:

·         Create a set of fixtures to translate from Fit tables to my model.

·         Create an abstraction on top of Fit that make it looks like the database it used.

·         Mock several parts of the implementation for the Fit tests (parts that I don’t really control).

·         Mock the database layer for ActiveRecord..

 

With so many levels of indirection, I’m afraid that I’ll tests my mocking, and not the business objects J

I started to mock the database, but I soon lost myself in the details. I think that for now I’m going to just use the database (after all, Fit is supposed to be all about acceptance tests.)

One more thing to consider if you’re going to use Fitnesse for your tests, learn to love the Debugger.Break(), it will helps you out of situations you can’t understand how you’ve gotten yourself into. One word of warning, most of the documentation for Fit and Fitnesse is about the Java version, and the .Net version lacks some abilities that would make working with it much easier. Specifically, I’m talking about the FitLibrary for .Net.

I’ve been able to create a fixture that would be Good Enough ™ for my needs, so it wasn’t that much of a problem for me.