Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 522
Mikey Avatar asked Dec 30 '25 12:12

Mikey


1 Answers

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.

like image 54
theon Avatar answered Jan 03 '26 22:01

theon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!