I have a Selenide+Java project which uses allure reporting. I am using the TestExecutionListener to handle browser setup, but I am having some extreme difficulty figuring out how to add screenshots to the report on a test failure.
I'm using
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-junit5</artifactId>
<version>2.13.0</version>
<scope>test</scope>
</dependency>
And in my Listener code:
public class BrowserListener implements TestExecutionListener {
Browser browser;
@Override
public void executionStarted(TestIdentifier testIdentifier) {
if(testIdentifier.isTest()) {
browser = new Browser();
browser.openBrowser();
}
}
@Override
public void executionFinished(TestIdentifier testIdentifier, TestExecutionResult testExecutionResult) {
//code here to log failed execution - ideally would like to put screenshot on failure
browser.close();
}
}
How do I add a screenshot to an Allure report using Selenide/Junit 5?