private ScreenshotMetaData getMetaData(TestLifecycleEvent event) { ScreenshotMetaData metaData = new ScreenshotMetaData(); metaData.setTestClass(event.getTestClass()); metaData.setTestMethod(event.getTestMethod()); metaData.setTimeStamp(System.currentTimeMillis()); return metaData; }
public void afterTest(@Observes After event) { TestResult result = testResult.get(); if (strategy.get().isTakingAction(event, result)) { ScreenshotType screenshotType = getScreenshotType(); ScreenshotMetaData metaData = getMetaData(event); metaData.setTestResult(result); beforeScreenshotTaken.fire(new BeforeScreenshotTaken(screenshotType, metaData)); takeScreenshot.fire( new TakeScreenshot( screenshotType, metaData, result.getStatus() == TestResult.Status.FAILED ? When.FAILED : When.AFTER)); afterScreenshotTaken.fire(new AfterScreenshotTaken(screenshotType, metaData)); } }