October 6, 2006

FitNesse and Data Conversion

I blogged quite some time ago about some data conversion testing I was doing. The customer has a freaky proto-database made up of hundereds of separate MS Excel worksheets and frequently running into the old Excel maximum row count limit. We're doing the sensible thing and getting it into a relational DB (in this case MSSQL 2005). Dont ask me how they managed up until now.

I'm way overdue for an update on this, so here we go:

I ended up working mostly with FitNesse and SQL stored procedures.

I absolutely love FitNesse. For those of you who dont know it, FitNesse is based on Fit - a tool for writing and executing 'story tests' that both describe the desired behaviour of the system (requirements) and validate that the behaviour is achieved. FitNesse is a wiki based platform for writing and running these Fit tests. You can read more about it here.

I had (the .NET 2.0 variant of) Fitnesse executing stored procedures retrieving data for given set of parameters, and checking that the result sets matched. The tests can involve many assertions, and they can be organised into Suites covering logical areas and suites of suites - covering pretty much the whole system.

Given that there is absolutely masses of data (and conversion rules) I wanted to automate as much of these tests as possible, this meant I could keep working through the spec (chasing the dev) but every time I ran a test, I'd re-run ALL the old ones. Thing would break way back quite regularly. Once we got to feature complete, we just satrting doing bugfixes, and turning red tests into green ones.

At this point (near the end I'm hoping) I have 2300 odd tests running with every migration pass. Of course I could have had some big arsed SQL scripts going and doing the same thing, but for me the beauty of the FitNesse tool is the following two points:

Reporting - The outcome of the test runs is very obvious ( green / red colour coded to the test and assertion that has failed)

Maintainability - The tests themselves (including the expected results) are easily editable.

Oh ... and as they're "self documenting" pretty much circumvent writing test cases in Word.

Im sold on it.

Now I'm looking at getting some browser automation going with FitNesse. I'm looking at WatiN ( an I.E. automation framework like the Ruby WATIR framework, but for .NET ). More on this later.