Writing Stupid Specifications with Concordion

Published: 11:05 PM GMT+12, Saturday, 30 May 2009 under: technology
concordion  testing  development  git  github 

For a while I've been an avid lover of the concordion testing framework, but one thing I always struggled with was the separation of state/data between the specification and the fixture. As a simple work around I added a simple "eval" command, which simply takes an elements content and turns it into a camel cased method name to call on the fixture.

When using a specification marked up as:

a specification with the following methods is exercised:

The result is a very lightweight specification that contains no state, data, or scripting in it, and by sticking to a single command, I open myself up to driving concordion from a simple wiki syntax without having to worry about how to encode all the various commands.

The eval command itself is fairly simple:

I have some ideas to improve further on this (stealing from Cucumber) to extract any numbers, or strings in quotes as parameters to the evaluated method which should add even more value to these extremely simple specifications, along with a similar "echoeval" command to insert content from the fixture into the rendered specification.

I'm sure a lot of people might cringe at this way of writing tests and specifications, but I'm finding I can very quickly jot down a sentence or two about something I want to test as it occurs to me in the form of a specification (rather than a TODO comment or JIRA task) and immediately have it fire up as a failing test.

Comments (0)

Add Comment