Mikey
Mikey

Reputation: 4742

Do any of the BDD frameworks for grails (spock/geb/easyb/other) support regular expression parsing of the human readable descriptions?

I am trying to do this grails thing right, and I figure I should be using tests. My only experience with tests is during the 3 or so hours my buddy taught me cucumber on rails...

In cucumber you separate the "descriptions" and "definitions" and use regular expressions. Easyb looks really close but the descriptions and the definitions are right on top of each other.

So in cucumber I can do something which looks like

given "I have done myFancyThing"
then "I should see the fancyThingResponse"

given "I have done myNormalThing"
then "I should see normalThingResponse"

and then there is only one function for "given I have done X" and one function for "then I should see X"

It seems with easyb for example I would have to rewrite the code for each description like

given "I have done myFancyThing"{
  //code code code
}

given "I have done myNormalThing"{
  //cucumber is dryer than easyb?
}

Am I wrong about easyb? Is there a designed-for-java/groovy testing framework which has this, or some kind of groovy way to add this in that I'm not thinking of?

Upvotes: 3

Views: 547

Answers (2)

Robert Beltran
Robert Beltran

Reputation: 494

Look into Geb and Spock. Seriously awesome testing framework. Beats using cucumber

Geb

Spock

Upvotes: 0

theon
theon

Reputation: 14390

I haven't used easyb before, but I looked through the docs and I think you are right. It looks like they don't support regexes which I guess could make re-usability of your step definitions a lot harder.

Have you tried cucumber for the JVM? We use it at work with Java and it works pretty well (has the regex support you need etc). There is groovy support out of the box and this project looks like it integrates it with grails.

Upvotes: 1

Related Questions