В своем проекте я использую огурец с web-драйвером junit, maven и selenium, включая отчет по java и экстентам.Мой отчет по экстентам генерируется в папке «output» и в той же папке сохраняется скриншот неудачных тестов.После выполнения теста и генерации отчета я хочу сжать папку «output» в zip-файл и отправить ее по почте.
Проблема: в случае, когда мой код преобразует файл в формат zip, тест-отчет еще не сгенерирован (так как он генерируется после завершения всех тестовых случаев), поэтому, когда папка 'output' сжимается, она содержит только сбойный скриншот и отправляется по почте. Пожалуйста, предложите , это мой бегунфайл это мой класс хуков
это мой класс бегунов ...............
@CucumberOptions(
features = {"featurefiles/DefineStaffType.feature"}
, glue = {"stepdefinitions"}
, monochrome = true
, plugin = {"pretty:STDOUT",
"json:target/cucumber.json",
"junit:target/cucumber.xml",
"com.cucumber.listener.ExtentCucumberFormatter:output/report.html"}
, tags = {"@Scenario1, @Scenario2, @Scenario3"}
)
public class DefineStaffTypeRunner {
@AfterClass
public static void reportSetup ( ) throws IOException, EmailException {
Reporter.loadXMLConfig ( new File ( "configuration\\extentconfig.xml" ) );
Reporter.setSystemInfo ( "User Name", System.getProperty ( "user.name" ) );
Reporter.setSystemInfo ( "Time Zone", System.getProperty ( "user.timezone" ) );
Reporter.setSystemInfo ( "64 Bit", "Windows 10" );
Reporter.setSystemInfo ( "3.1.0", "Selenium" );
Reporter.setSystemInfo ( "1.9", "Maven" );
Reporter.setSystemInfo ( "1.9", "Java Version" );
Reporter.setTestRunnerOutput ( "Define Staff Type " );
FileConversion.convertToZip ( "output" );
new MailHandlingUtility ( ).sendMailWithAttachment ( );
}
}
Это мой класс крючков
public class CucumberHooks extends GenericBaseClass {
DriverMethods dm = new DriverMethods ( );
CaptureScreenshot cs = new CaptureScreenshot ( );
static MailHandlingUtility mhu = new MailHandlingUtility ( );
@Before
public void launchBrowser (Scenario currentscenario) throws IOException {
this.scenario = currentscenario;
driver = getCurrentDriver ( );
dm.maximizeWindow ( );
}
@After
public void tearDownScenario (Scenario currentscenario) throws IOException, EmailException {
scenario.write ( "Scenario is finished" + currentscenario );
cs.catureScreenshot ( (Scenario) scenario );
driver.close ( );
driver.quit ( );
driver = null;
}
}