How to extract Cucumber step name during test execution in Java

1,604 views
Skip to first unread message

Maria Klimenko

unread,
Apr 2, 2019, 12:30:36 PM4/2/19
to Cukes
Hello! 

I am looking for the way to capture the time taken to execute each step in the scenario, i.e. print perf counters. I think that using hooks @BeforeStep and @AfterStep would ideal for this task though I didn't find any way to extract current step name in runtime.
Class Scenario gives me only scenario name, tags, etc but no step name! Is there any way to get the current step name during test execution?

Thank you.

Maria

Gabriel Oliveira

unread,
Apr 2, 2019, 12:47:42 PM4/2/19
to cu...@googlegroups.com
I lack any knowledge about Cucumber in Java, but I can offer a different perspective: have you tried this language options to retrieve the method name (samples in [1] and [2]) or to retrieve annotations ([3] and [4]) ?

Would be nice to have this baked in Cucumber somehow tough... so the main question remains open.

-- 

Gabriel P.A. de Oliveira
https://gpaoliveirablog.wordpress.com


--
Posting rules: https://cucumber.io/support/posting-rules
---
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.

Vincent Daburon

unread,
Apr 4, 2019, 5:14:01 AM4/4/19
to Cukes
Hi,

With cucumber report jenkins plugin, you have in the report the time taken for all steps individually.

This time is extract from json cucumber result file.

Regards.
Vincent DAB.
Reply all
Reply to author
Forward
0 new messages