I want to access all the cucumber scenario steps in @before hook. Is there a way to do this?
I have tried passing the cucumber scenario object in the before hook method but it only provides the basic info like scenario.getName(), scenario.getId(). What I require is something like getSteps() which give me the List<String> of all the steps of that particular scenario.
What I am looking for is something like this
@Before("@dev")
public void testcase(Scenario scenario){
for (Step a : scenario.getSteps()) {
System.out.println("scenario step = " + a.getText());
}
}
Basically I want the complete scenario information at the beginning of the test execution itself.
If I pass the argument of class cucumber.api.TestCase in the before method then I can access the getTestSteps() method but that leads to below exception.
cucumber.runtime.CucumberException: When a hook declares an argument it must be of type cucumber.api.Scenario. public void com.thermofisher.bid.spa.kingfisher.ui.steps.Hooks.poc(cucumber.api.TestCase)
