Forum Discussion

Camo's avatar
Occasional Contributor
4 years ago

Is it possible to get scenario inside the step in Cucumber?

I need to make screenshot inside the step on specific place. It means not on @BeforeStep nor on @AfterStep. I need to call

// public void someStep(Scenario scenario)  // This does not work

public void someStep()
    scenario.attach(screenshot(), "image/png", fileName1);
    scenario.attach(screenshot(), "image/png", fileName2);

But I am not able to get current scenario related to the step execution. Is it possible or not? I tried to call it like someStep(Scenarion scenario) but it throws an error.


Thanks for any help.