[rspec-users] Quickcheck testing framework

Matt Wynne matt at mattwynne.net
Tue May 18 10:27:47 EDT 2010

On 16 May 2010, at 18:54, Scott Taylor wrote:

> Hey all,
> I'm wondering if anyone has any experience with an automated test-case generation tool like Quickcheck (for erlang/haskell). I'd be interested in hearing any impressions, war stories, or dev workflows regarding a tool like this.  Talking off list to David C, he suggested that it might be a complimentary tool to a TDD/BDD framework like rspec. 
> It appears as though there is a similar project out there for ruby named rushcheck (http://rushcheck.rubyforge.org/).  Doesn't seem like it's been maintained in a few years, though, and I'm guessing no one is using it.  I wonder if it these automated test generation tools are more appropriate in functional languages like Haskell and Erlang.
> Scott

A year ago I was at the SPA conference (which I'm at right now) in London. The whole week ended up being very Haskell-themed, with Simon Peyton-Jones doing a keynote, a couple of different tutorials and some impromptu dojos at lunchtime.

Then on the last day a couple of French guys ran a fascinating session. They had a simple CLI Java app which simulated an ATM machine. The first part of the exercise was to build a model of the behaviour of the ATM program. The model was based on naming the different states that the ATM could be in (waiting for PIN, waiting for amount etc) and the possible transitions between those states (enter incorrect PIN, enter amount etc). We then used Haskell to build a representation of that model in code. The idea (which we didn't have time to get to in the session) was then to connect the Haskell model to the real application and use QuickCheck to spray test-cases at it, through the Haskell model.

One of the interesting things for me was how similar that model felt to a set of Cucumber features. In Cucumber we express behaviour in terms of scenarios where we put the application into a particular state, interfere with it in some way, and then see what state it has transitioned into. So when we write Gherkin features for our programs we're really building up a model of how we expect the application to behave.

I wondered at the time whether there was any way to either actually generate a Haskell wrapper model from Gherkin code (in order to use QuickCheck) or somehow write a QuickCheck-like program in Ruby that understood Gherkin.

Then I went back to work and forgot all about it.

> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

More information about the rspec-users mailing list