According to the documentation on Hooks on the Cucumber Wiki on GitHub, the answer is no. There is Before but no BeforeStep. Depending on what you are trying to achieve, Before might do what you need.
I am running cucumber within TestNG. I'd like to print the step definition names out as the feature file is processed. This doesn't appear to happen when running under TestNG. If I had a BeforesStep annotation on a method such as beforeStep(StepDefinition sd)
(or something like that), I'd log the step definition name. That would ve very useful.
Is there a different way to do this with Java Cucumber ?
So far as Before is executed before each scenario and AfterStep - after each step in scenario, to achieve BeforeStep you can simply place you code in both hooks: Before and AfterStep.
According to the documentation on Hooks on the Cucumber Wiki on GitHub, the answer is no. There is
Before
but noBeforeStep
. Depending on what you are trying to achieve,Before
might do what you need.I know it is quite outdated question but:
Before might be used explicitly e.g before scenario but sometimes it is pointles due to fact that it pollute scenarios description.
I use in support/hooks.rb e.g
It might be usefull in case when some action action must be repeted before EVERY scenario in test set.
I am running cucumber within TestNG. I'd like to print the step definition names out as the feature file is processed. This doesn't appear to happen when running under TestNG. If I had a BeforesStep annotation on a method such as beforeStep(StepDefinition sd) (or something like that), I'd log the step definition name. That would ve very useful.
Is there a different way to do this with Java Cucumber ?
So far as
Before
is executed before each scenario andAfterStep
- after each step in scenario, to achieve BeforeStep you can simply place you code in both hooks: Before and AfterStep.