run only first example of each table

25 views
Skip to first unread message

sean.wo...@gmail.com

unread,
Oct 20, 2016, 7:08:44 AM10/20/16
to Cukes
Hello everybody,


I'm looking for a way to run only the first example of all my feature files. Is this possible?

Maybe with a pre-hook? Can I get visibility into which example is running, and ignore all but the first?

Thanks!


Andrew Premdas

unread,
Oct 20, 2016, 10:36:14 AM10/20/16
to cu...@googlegroups.com
I don't think this is possible

The fact that you want to do it is an indication that you have some fairly big problems with you scenarios. Big example tables are bad.

One simple, but time consuming thing you could do is extract a single example into a separate scenario. Tag this @fast, and tag the scenario with the big table as @slow. Then you can choose which ones to run using the existing tags functionality.

--
Posting rules: http://cukes.info/posting-rules.html
---
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
------------------------
Andrew Premdas

Eric Kessler

unread,
Oct 20, 2016, 11:37:20 AM10/20/16
to Cukes


On Thursday, October 20, 2016 at 7:08:44 AM UTC-4, sean.wo...@gmail.com wrote:
Hello everybody,


I'm looking for a way to run only the first example of all my feature files. Is this possible?

I bet that I could whip up some code that would do that, yes. But why is this a this something that you want to do? What are you trying to accomplish?
 

Maybe with a pre-hook? Can I get visibility into which example is running, and ignore all but the first?

I don't know what can be done inside of Cucumber itself. I was just going to determine the file and line number of every one of your 'first examples' and then tell Cucumber to run them. 
 

Thanks!


Eric Kessler

unread,
Oct 20, 2016, 3:14:21 PM10/20/16
to Cukes


On Thursday, October 20, 2016 at 11:37:20 AM UTC-4, Eric Kessler wrote:


On Thursday, October 20, 2016 at 7:08:44 AM UTC-4, sean.wo...@gmail.com wrote:
Hello everybody,


I'm looking for a way to run only the first example of all my feature files. Is this possible?

I bet that I could whip up some code that would do that, yes. But why is this a this something that you want to do? What are you trying to accomplish?


It only runs the first scenario of every feature but it would be straightforward to adapt it so that it runs the first row of every example table. 

aslak hellesoy

unread,
Oct 20, 2016, 3:30:31 PM10/20/16
to Cucumber Users
On Thu, Oct 20, 2016 at 5:52 AM, <sean.wo...@gmail.com> wrote:
Hello everybody,


I'm looking for a way to run only the first example of all my feature files.

Can you explain why you want to do this?
 
Is this possible?

Maybe with a pre-hook? Can I get visibility into which example is running, and ignore all but the first?

Thanks!


Steve Tooke

unread,
Oct 20, 2016, 4:09:55 PM10/20/16
to cu...@googlegroups.com


On 20 Oct 2016, at 15:36, Andrew Premdas <apre...@gmail.com> wrote:

I don't think this is possible

The fact that you want to do it is an indication that you have some fairly big problems with you scenarios. Big example tables are bad.

One simple, but time consuming thing you could do is extract a single example into a separate scenario. Tag this @fast, and tag the scenario with the big table as @slow. Then you can choose which ones to run using the existing tags functionality.

You could also have 2 examples tables for each scenario, with one table tagged @critical or @fast or something. The first examples table could have the example you want to run. 

I'm also interested in why, though. 


On 20 October 2016 at 05:52, <sean.wo...@gmail.com> wrote:
Hello everybody,


I'm looking for a way to run only the first example of all my feature files. Is this possible?

Maybe with a pre-hook? Can I get visibility into which example is running, and ignore all but the first?

Thanks!


--
Posting rules: http://cukes.info/posting-rules.html
---
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
------------------------
Andrew Premdas

--
Posting rules: http://cukes.info/posting-rules.html
---
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.
Reply all
Reply to author
Forward
0 new messages