How to Embed / Attach screenshots when each step is executed in Cucumber



  • I need to take a screenshot after each step of execution and embed them in results. I have tried using the "After" method but it captures only the last screen and displays it at the end of the report.



  • It seems you are already able to do most of the screenshot, the After you are using will only take a screenshot after everything, instead of after each step.

    You need to do an @AfterStep inside your hooks file:

    @AfterStep
    public void doSomethingAfterStep(Scenario scenario){
    }
    


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2