2

エクステント レポートを生成しようとすると、このエラーが発生します。reports.endTest(test); で既にレポートを閉じています。

これが私のコードです:

@BeforeMethod public void beforeMethod(Method メソッド) { test = reports.startTest((this.getClass().getSimpleName() + "::" + method.getName()), method.getName()); test.assignAuthor("ロイ"); test.assignCategory("スモーク テスト"); }

@Test(priority = 0)
public static void initialSetup() throws InterruptedException, IOException {
    System.setProperty("webdriver.ie.driver", "\\IEDriverServer.exe");
    b = new InternetExplorerDriver();

    b.get("https://something.com");
    Alert alert = b.switchTo().alert();

    String _user_name = "kirstie";
    String _password = "88525";
    alert.authenticateUsing(new UserAndPassword(_user_name, _password));
    b.switchTo().defaultContent();

}

@Test(priority = 1, enabled = true)
public static void secondClient() throws Exception {

    b.findElement(By.xpath("//*[@class='main-sidebar open']")).click();

    b.findElement(By.xpath("//*[@class='sub-menu group open']/li")).click();

}

@AfterMethod
public void afterMethod(ITestResult iTestResult) throws IOException {

    if (iTestResult.getStatus() == ITestResult.FAILURE) {
        String screenshotPath = GetScreenshot.capture(driver, "screenShots");
        test.log(LogStatus.FAIL, "Screenshot", test.addScreenCapture(screenshotPath));
        test.log(LogStatus.FAIL, "Test Case Failed is " + iTestResult.getName());
        test.log(LogStatus.FAIL, "Test Case Failed is " + iTestResult.getThrowable());
    } else if (iTestResult.getStatus() == ITestResult.SKIP) {
        test.log(LogStatus.SKIP, "Test Case Skipped is " + iTestResult.getName());
    }
    reports.endTest(test);
}

@AfterSuite
public void afterSuite() {

    reports.flush();
    reports.close();
}
4

2 に答える 2