Step Definitions are echoed after execution rather than before

19 views
Skip to first unread message

Xeno Campanoli

unread,
Dec 2, 2016, 9:14:14 AM12/2/16
to Cukes
Our group would like the step definitions to be echoed to our output channel before they are executed rather than after.  Please how would we configure this?

xc

aslak hellesoy

unread,
Dec 2, 2016, 10:36:37 AM12/2/16
to cu...@googlegroups.com
You want to print the whole java/ruby/js stepdef with code and all? Or just the regexp?

Why do you want this?

What platform are you on?

Aslak

On Fri, 2 Dec 2016 at 14:14, Xeno Campanoli <xeno.ca...@gmail.com> wrote:
Our group would like the step definitions to be echoed to our output channel before they are executed rather than after.  Please how would we configure this?

xc

--
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.
For more options, visit https://groups.google.com/d/optout.

Eric Kessler

unread,
Dec 2, 2016, 12:08:03 PM12/2/16
to Cukes


On Friday, December 2, 2016 at 10:36:37 AM UTC-5, Aslak Hellesøy wrote:
You want to print the whole java/ruby/js stepdef with code and all? Or just the regexp?

I think that they don't want anything different than what is printed out now. They just want it printed out at a different time.
 

Why do you want this?

Probably because, currently, the output of a step is not printed to the console until after the step is complete. This means that what you see in the application as your test executes and what you see in the console as the Gherkin is gone through will never line up. This is particularly annoying if you are trying to debug a test and your debug statements don't show up until after the related action has occurred (yes, some people debug by printing out the values of stuff instead of using a fancy debugging tool).

Xeno Campanoli

unread,
Dec 2, 2016, 4:17:52 PM12/2/16
to Cukes
Yes, thank you Our reason is the desire in meetings to see our results of the step after the statement of the step.  Since we use these tests as acceptance tests (the whole rational of using Cucumber over minitest, which in other ways is now our preference, is to cleanly provide the test results to non-programming collaborators like engineers who provide specifications and want to see acceptance test results details.  Therefore, such conversations are seriously hampered, we find, all the time, by the order of echo of the gherkin statements after their corresponding execution.

Thank you for helping me clarify this.  Apologies for my slow response.

Xeno Campanoli

unread,
Dec 2, 2016, 4:20:13 PM12/2/16
to Cukes
We are on RedHat 6.7 with:

[tester@stim-node tests]$ ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]

Xeno Campanoli

unread,
Dec 2, 2016, 4:21:01 PM12/2/16
to Cukes
We would like each step Gherkin to echo before the executions it represents.


On Friday, December 2, 2016 at 7:36:37 AM UTC-8, Aslak Hellesøy wrote:

Xeno Campanoli

unread,
Dec 2, 2016, 4:22:17 PM12/2/16
to Cukes
We would like this because we find the present operations confuse non-coding collaborators who want to help us audit our results, most especially specifications stewards who are not always code savvy.


On Friday, December 2, 2016 at 7:36:37 AM UTC-8, Aslak Hellesøy wrote:

Aslak Hellesøy

unread,
Dec 2, 2016, 5:03:27 PM12/2/16
to Cukes
Try `Kernel.puts` instead of `puts`.

Cucumber provides its own `puts` method, which defers printing the output until the step has finished. The reson
for this is purely aesthetic - many people find it nicer to read when it's underneath the step.
Of course, this isn't always practical, when steps are slow, in which case you should use `Kernel.puts`, which
prints immediately.

HTH,
Aslak

Xeno Campanoli

unread,
Dec 2, 2016, 5:19:23 PM12/2/16
to Cukes
Thank you Aslak.  I will tell my collaborator.  
Reply all
Reply to author
Forward
0 new messages