What would be the best way to capture screenshots after each step when running integration tests?
Tests are written in Java using Selenium(3.0.1) and Cucumber(1.2.4).
Code for taking a screenshot after a test is below, but I need a screenshot after each method annotated with @Given, @When, @Then.
@After
public void after(Scenario scenario){
final byte[] screenshot = driver.getScreenshotAs(OutputType.BYTES);
scenario.embed(screenshot, "image/png");
}
Thank you for any hints.
I don't think it would be possible until following merge request is accepted and merged. if you are really interested you can merge it locally and have your own custom Jar.
https://github.com/cucumber/cucumber-jvm/pull/838
Can this post help you?
Embedding screenshots in Cucumber JVM