Re: [Groovy][Cucumber] How do nested steps work in groovy?

120 views
Skip to first unread message

Seb Rose

unread,
Apr 25, 2013, 4:57:47 AM4/25/13
to cu...@googlegroups.com
On 25 April 2013 09:24, <mze...@googlemail.com> wrote:
Hi,

could anybody give me a clue how nested steps in groovy can be achieved?

Are you really, really, really sure you want to use nested steps. The collective experience of practitioners is that nested steps are a bad idea and should be avoided. Matt and Aslak even regret mentioning them in The Cucumber Book.


When(~'^Sample Condition One$') { ->
       //Groovy code with three steps below
       // --> How are teh steps called from here?
}


And(~'^Sub step one$') { ->
       //one
}

And(~'^Sub step two$') { ->
       //two
}

And(~'^Sub step three$') { ->
       //three
}

Thanks!
Martin



--
-- Rules --
 
1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.
 
You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cu...@googlegroups.com. To unsubscribe from this group, send email to cukes+un...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
ACCU - Professionalism in Programming - http://accu.org

http://www.claysnow.co.uk
http://twitter.com/#!/sebrose
http://uk.linkedin.com/in/sebrose

aslak hellesoy

unread,
Apr 25, 2013, 5:08:08 AM4/25/13
to Cucumber Users
On Thu, Apr 25, 2013 at 9:57 AM, Seb Rose <s...@claysnow.co.uk> wrote:
On 25 April 2013 09:24, <mze...@googlemail.com> wrote:
Hi,

could anybody give me a clue how nested steps in groovy can be achieved?

Are you really, really, really sure you want to use nested steps. The collective experience of practitioners is that nested steps are a bad idea and should be avoided. Matt and Aslak even regret mentioning them in The Cucumber Book.

Thanks Seb.

Use method calls instead. There are numerous email threads, blog pots and online presentations that describe how to do this.
Wasn't there one or two about this at the recent CukeUp conference? The talks are online.

Aslak

mze...@googlemail.com

unread,
Apr 25, 2013, 6:14:04 AM4/25/13
to cu...@googlegroups.com
Sounds like I was opening pandoras box - I will have a look at better solutions!

Martin


Am Donnerstag, 25. April 2013 10:24:55 UTC+2 schrieb mze...@googlemail.com:
Hi,

could anybody give me a clue how nested steps in groovy can be achieved?

Seb Rose

unread,
Apr 25, 2013, 6:17:58 AM4/25/13
to cu...@googlegroups.com
On 25 April 2013 11:14, <mze...@googlemail.com> wrote:
Sounds like I was opening pandoras box - I will have a look at better solutions!

Pandora is already out - we're trying hard to stuff her back in and close the lid :) 

Martin

Am Donnerstag, 25. April 2013 10:24:55 UTC+2 schrieb mze...@googlemail.com:
Hi,

could anybody give me a clue how nested steps in groovy can be achieved?

When(~'^Sample Condition One$') { ->
       //Groovy code with three steps below
       // --> How are teh steps called from here?
}


And(~'^Sub step one$') { ->
       //one
}

And(~'^Sub step two$') { ->
       //two
}

And(~'^Sub step three$') { ->
       //three
}

Thanks!
Martin



--
-- Rules --
 
1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.
 
You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cu...@googlegroups.com. To unsubscribe from this group, send email to cukes+un...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply all
Reply to author
Forward
0 new messages