Проект Java + Selenide + TestNG + Maven
Пытаюсь настроить Аллюр, чтобы аттачи добавлялись в случае падения теста для этого переопределил класс ITestListener и добавил в базовый тестовый класс слушателя, но в самом отчете не вижу аттачей, может быть что-то еще нужно сделать или я не там ищу аттачи?
public class CustomTestListener implements ITestListener {
private Logger log = LoggerFactory.getLogger(CustomTestListener.class);
@Override
public void onTestStart(ITestResult result)
{
log.info("Test class started:" + result.getTestClass().getName());
log.info("Test started: " + result.getName());
}
@Override
public void onTestSuccess(ITestResult result)
{
log.info("Test SUCCESS: " + result.getName());
}
@Override
public void onTestFailure(ITestResult result) {
AllureAttachment.screenshotAs("Last screenshot");
AllureAttachment.pageSource();
AllureAttachment.browserConsoleLogs();
log.info("Test FAILED: " + result.getName());
if (result.getThrowable()!=null) {
result.getThrowable().printStackTrace();
}
}
}
@Listeners({CustomTestListener.class})
public class BaseTest {
protected App app;
protected SoftAssert softAssert;
protected Logger logger;
@Attachment(value = "{attachName}", type = "image/png")
public static byte[] screenshotAs(String attachName) {
return ((TakesScreenshot) getWebDriver()).getScreenshotAs(OutputType.BYTES);
}