Discussion:
[Cucumber] Is there a way to get step names from feature files in Cucumber ? Like how we get the scenario names
(too old to reply)
v***@gmail.com
2018-01-06 07:03:29 UTC
Permalink
Raw Message
This is how I use to call the scenario names.
@Before
public void beforetest(Scenario scenario) {
ScenarioName = scenario.getName();
// StepName = scenario.getId();

// String stepname=ScenarioName

}

Any help please it really helps. 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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'sridevi ennam' via Cukes
2018-01-06 15:09:26 UTC
Permalink
Raw Message
As far as I knew there is no defined method in cucumber to get the step name as we get scenario name,id, tags etc.

Depends on your need you could try different hard coded methods using your programming language (Java,c# whichever you use)

Usually steps in scenario will look for its matching snippets and they are unique. So you could save that step name in a String (though it’s not a good idea)
,return to the method you use for your step and save it in an object. In the @After method fetch all the stored objects.

I would be happy to see if any one got more suggestions on this.

Sent from my iPhone
Post by v***@gmail.com
This is how I use to call the scenario names.
@Before
public void beforetest(Scenario scenario) {
ScenarioName = scenario.getName();
// StepName = scenario.getId();
// String stepname=ScenarioName
}
Any help please it really helps. Thanks
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
For more options, visit https://groups.google.com/d/optout.
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Koen Prins
2018-01-06 18:21:37 UTC
Permalink
Raw Message
What is the problem you are trying to solve by calling a step?

On Sat, Jan 6, 2018 at 4:09 PM, 'sridevi ennam' via Cukes <
Post by 'sridevi ennam' via Cukes
As far as I knew there is no defined method in cucumber to get the step
name as we get scenario name,id, tags etc.
Depends on your need you could try different hard coded methods using your
programming language (Java,c# whichever you use)
Usually steps in scenario will look for its matching snippets and they are
unique. So you could save that step name in a String (though it’s not a
good idea)
,return to the method you use for your step and save it in an object. In
I would be happy to see if any one got more suggestions on this.
Sent from my iPhone
This is how I use to call the scenario names.
@Before
public void beforetest(Scenario scenario) {
ScenarioName = scenario.getName();
// StepName = scenario.getId();
// String stepname=ScenarioName
}
Any help please it really helps. 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
For more options, visit https://groups.google.com/d/optout.
--
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
For more options, visit https://groups.google.com/d/optout.
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
v***@gmail.com
2018-01-07 06:51:20 UTC
Permalink
Raw Message
I am trying to generate excel reporting. I was able to get the Scenario
names, but I don't know how to get the Step names from feature file.

If I get the step names, then I don't need to hard code them in my test. I
can use the same Step name for printing in it on Excel sheet.

Please do let me know how to use.


Sridevi, i am using Java language.
Post by Koen Prins
What is the problem you are trying to solve by calling a step?
On Sat, Jan 6, 2018 at 4:09 PM, 'sridevi ennam' via Cukes <
Post by 'sridevi ennam' via Cukes
As far as I knew there is no defined method in cucumber to get the step
name as we get scenario name,id, tags etc.
Depends on your need you could try different hard coded methods using
your programming language (Java,c# whichever you use)
Usually steps in scenario will look for its matching snippets and they
are unique. So you could save that step name in a String (though it’s not a
good idea)
,return to the method you use for your step and save it in an object. In
I would be happy to see if any one got more suggestions on this.
Sent from my iPhone
This is how I use to call the scenario names.
@Before
public void beforetest(Scenario scenario) {
ScenarioName = scenario.getName();
// StepName = scenario.getId();
// String stepname=ScenarioName
}
Any help please it really helps. 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
For more options, visit https://groups.google.com/d/optout.
--
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
For more options, visit https://groups.google.com/d/optout.
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
George Dinwiddie
2018-01-07 16:49:02 UTC
Permalink
Raw Message
Sridevi,
Post by v***@gmail.com
I am trying to generate excel reporting. I was able to get the Scenario
names, but I don't know how to get the Step names from feature file.
If you're trying to do custom reporting, why not create a custom plugin?
That's the intended way of doing it, not with hooks.

See https://automationrhapsody.com/create-cucumber-jvm-custom-formatter/
for a starting point.

- George
Post by v***@gmail.com
If I get the step names, then I don't need to hard code them in my test.
I can use the same Step name for printing in it on Excel sheet.
Please do let me know how to use.
Sridevi, i am using Java language.
What is the problem you are trying to solve by calling a step?
On Sat, Jan 6, 2018 at 4:09 PM, 'sridevi ennam' via Cukes
As far as I knew there is no defined method in cucumber to get
the step name as we get scenario name,id, tags etc.
Depends on your need you could try different hard coded methods
using your programming language (Java,c# whichever you use)
Usually steps in scenario will look for its matching snippets
and they are unique. So you could save that step name in a
String (though it’s not a good idea)
,return to the method you use for your step and save it in an
I would be happy to see if any one got more suggestions on this.
Sent from my iPhone
Post by v***@gmail.com
This is how I use to call the scenario names.
@Before
public void beforetest(Scenario scenario) {
ScenarioName = scenario.getName();
// StepName = scenario.getId();
|    // String stepname=ScenarioName } |
Any help please it really helps. Thanks
--
----------------------------------------------------------------------
* George Dinwiddie * http://blog.gdinwiddie.com
Software Development http://www.idiacomputing.com
Consultant and Coach http://www.agilemaryland.org
----------------------------------------------------------------------
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Björn Rasmusson
2018-01-07 18:07:21 UTC
Permalink
Raw Message
Post by v***@gmail.com
Sridevi,
Post by v***@gmail.com
I am trying to generate excel reporting. I was able to get the Scenario
names, but I don't know how to get the Step names from feature file.
If you're trying to do custom reporting, why not create a custom plugin?
That's the intended way of doing it, not with hooks.
I agree completely.
Post by v***@gmail.com
See https://automationrhapsody.com/create-cucumber-jvm-custom-formatter/
for a starting point.
This post describes the old custom formatter interface used in version 2
of the Gherkin library, which is used in Cucumber-JVM v1.x.x.
In Cucumber-JVM v2.x.x newer versions of the Gherkin library is used, and
the formatter interface is based on the new event model where formatters
register handlers for events, see for instance the built in Json formatter
<https://github.com/cucumber/cucumber-jvm/blob/master/core/src/main/java/cucumber/runtime/formatter/JSONFormatter.java#L50-L91>
.

Regards
Björn
Post by v***@gmail.com
- George
Post by v***@gmail.com
If I get the step names, then I don't need to hard code them in my test.
I can use the same Step name for printing in it on Excel sheet.
Please do let me know how to use.
Sridevi, i am using Java language.
What is the problem you are trying to solve by calling a step?
On Sat, Jan 6, 2018 at 4:09 PM, 'sridevi ennam' via Cukes
As far as I knew there is no defined method in cucumber to get
the step name as we get scenario name,id, tags etc.
Depends on your need you could try different hard coded methods
using your programming language (Java,c# whichever you use)
Usually steps in scenario will look for its matching snippets
and they are unique. So you could save that step name in a
String (though it’s not a good idea)
,return to the method you use for your step and save it in an
I would be happy to see if any one got more suggestions on this.
Sent from my iPhone
Post by v***@gmail.com
This is how I use to call the scenario names.
@Before
public void beforetest(Scenario scenario) {
ScenarioName = scenario.getName();
// StepName = scenario.getId();
| // String stepname=ScenarioName } |
Any help please it really helps. Thanks
--
----------------------------------------------------------------------
* George Dinwiddie * http://blog.gdinwiddie.com
Software Development http://www.idiacomputing.com
Consultant and Coach http://www.agilemaryland.org
----------------------------------------------------------------------
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
v***@gmail.com
2018-01-09 06:11:07 UTC
Permalink
Raw Message
This is an Excellent and awesome forum. My test works by creating a custom
for-matter which is simple and easy.

Thanks again.
Post by Björn Rasmusson
Post by v***@gmail.com
Sridevi,
Post by v***@gmail.com
I am trying to generate excel reporting. I was able to get the Scenario
names, but I don't know how to get the Step names from feature file.
If you're trying to do custom reporting, why not create a custom plugin?
That's the intended way of doing it, not with hooks.
I agree completely.
Post by v***@gmail.com
See https://automationrhapsody.com/create-cucumber-jvm-custom-formatter/
for a starting point.
This post describes the old custom formatter interface used in version 2
of the Gherkin library, which is used in Cucumber-JVM v1.x.x.
In Cucumber-JVM v2.x.x newer versions of the Gherkin library is used, and
the formatter interface is based on the new event model where formatters
register handlers for events, see for instance the built in Json formatter
<https://github.com/cucumber/cucumber-jvm/blob/master/core/src/main/java/cucumber/runtime/formatter/JSONFormatter.java#L50-L91>
.
Regards
Björn
Post by v***@gmail.com
- George
Post by v***@gmail.com
If I get the step names, then I don't need to hard code them in my
test.
Post by v***@gmail.com
I can use the same Step name for printing in it on Excel sheet.
Please do let me know how to use.
Sridevi, i am using Java language.
What is the problem you are trying to solve by calling a step?
On Sat, Jan 6, 2018 at 4:09 PM, 'sridevi ennam' via Cukes
As far as I knew there is no defined method in cucumber to get
the step name as we get scenario name,id, tags etc.
Depends on your need you could try different hard coded methods
using your programming language (Java,c# whichever you use)
Usually steps in scenario will look for its matching snippets
and they are unique. So you could save that step name in a
String (though it’s not a good idea)
,return to the method you use for your step and save it in an
I would be happy to see if any one got more suggestions on
this.
Post by v***@gmail.com
Sent from my iPhone
Post by v***@gmail.com
This is how I use to call the scenario names.
@Before
public void beforetest(Scenario scenario) {
ScenarioName = scenario.getName();
// StepName = scenario.getId();
| // String stepname=ScenarioName } |
Any help please it really helps. Thanks
--
----------------------------------------------------------------------
* George Dinwiddie * http://blog.gdinwiddie.com
Software Development http://www.idiacomputing.com
Consultant and Coach http://www.agilemaryland.org
----------------------------------------------------------------------
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...