Ivan's Blog

Vague mumblings about all sorts of things. Java, Agile, Open Source...

Monday, October 30, 2006

Literate Testing

I recently came across the notion of Literate Testing, making tests more expressive and easier to read. I suspect that it will have more use at the acceptance test level, but time will tell.

I initially watched this video which was very interesting. Following up at work a couple of day later I was just looking at a test I had jsut written and all I could see was the brackets and commas hiding the test conditions I was trying to write. So I had a quick go at the approach mentioned in the video, with pleasing results. Unfortunately, all the custom code seemed a little over-the-top.

I googled around a bit and found this brief article on infoQ. Which mentioned a specific way of using jMock. jMock is actually mentioned as partial inspiration in the video, so I extended the MockObjectTestCase and tried a few assertThat's, again, with a pleasant outcome - more meaningful test cases written almost as english sentences.

I think this is what I've been looking for in tests and will be trying a little more tomorrow.

One last google found blog entry, by Brian Marick, with some ruby examples. I paticularly like the 'workflow tests'...

Labels: