FitNesse Narratives
When we first heard of the "Given When Then" structure for writing acceptance tests, we knew instinctively that it was a better way of writing executable examples (wrapped in the structure of an automated test to reduce ambiguity). It was presented by Dan North and Joe Walnes at XP Day 2006.
Since then a number of frameworks have risen up using that structure. Many of these can be written in plain text. Despite this, there are still many teams using FitNesse and the new table parsing Test System called SLIM.
Unfortunately, the way FitNesse is used is, too often, as an .automated testing. tool rather than as a tool that documents desired software behaviours in a customer-friendly way (using automated tests). There is a substantial difference in practice, despite such subtle difference in the words.
FitNesse own acceptance tests require explanation text surrounding the tables. We liken this to having comments in code, they are at risk of not being maintained and becoming disconnected from the executable content. They also add clutter to the page making it harder to understand the intent than if the descriptive words themselves were executable.
For this reason - and because we find the "includes", variables and hierarchical wiki features of FitNesse useful, we wanted to give FitNesse users the opportunity to use the "Given When Then" style whilst enjoying the benefits of FitNesse.
You can watch previous episodes at pairwith.us/tv.
You can find the code involved in these projects on bitbucket:
- FitNesseNarratives - The examples we're creating in a FitNesse repository that are our interpretation of what the stories and acceptance tests for the FitNesse project might have been if they'd been approached in a BDD style.
- NarrativeFixture - The fixture we're writing that enables the examples in the FitNesseNarratives project to be written in a BDD style.
- JNarrate - A fluent API for writing BDD acceptance tests in code that is being used (and improved) to underpin the Narrative Fixture - also contains similar FitNesse acceptance tests but written in Java in a BDD style (see the JNarrate examples). This was written in Antony's spare time before pairwith.us so the implementation of jnarrate doesn't feature in the pairwith.us videos.