在我的项目中,我使用带有junit,maven和selenium webdriver的黄瓜,包括java和范围报告 . 我的范围报告在文件夹“输出”中生成,并且在同一文件夹中也保存了失败的测试用例的屏幕截图 . 执行测试和生成报告后,我想将文件夹'output'压缩成zip文件并邮寄 .

Issue : At the instance when my code converts the file into zip format, the test-report is not yet generated (as it generates after completion of all test cases) so when 'output' folder is compressed it only contains the failed screenshot and same is being mailed.. Please suggest this is my runner file this is my hooks class

这是我的跑步者...............

@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;
    }
}