All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.codeborne.selenide.testng.BrowserPerTest Maven / Gradle / Ivy

package com.codeborne.selenide.testng;

import org.testng.ITestResult;
import org.testng.reporters.ExitCodeListener;

import javax.annotation.ParametersAreNonnullByDefault;

import static com.codeborne.selenide.WebDriverRunner.closeWebDriver;

/**
 * Annotate your test class with {@code @Listeners({ BrowserPerTest.class})}
 */
@ParametersAreNonnullByDefault
public class BrowserPerTest extends ExitCodeListener {

  @Override
  public void onTestFailure(ITestResult result) {
    super.onTestFailure(result);
    closeWebDriver();
  }

  @Override
  public void onTestFailedButWithinSuccessPercentage(ITestResult result) {
    super.onTestFailedButWithinSuccessPercentage(result);
    closeWebDriver();
  }

  @Override
  public void onTestSuccess(ITestResult result) {
    super.onTestSuccess(result);
    closeWebDriver();
  }

  @Override
  public void onConfigurationFailure(ITestResult result) {
    super.onConfigurationFailure(result);
    closeWebDriver();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy