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

qa.justtestlah.hooks.WebDriverHooks Maven / Gradle / Ivy

Go to download

JustTestLah! is a JAVA test framework targeting projects that support multiple platforms, in particular Web, Android and iOS. It follows a BDD approach and allows testing against all platforms using the same feature files. JustTestLah's main aim is to make the configuration and the actual test code as easy as possible.

There is a newer version: 1.9-RC4
Show newest version
package qa.justtestlah.hooks;

import com.codeborne.selenide.WebDriverRunner;
import io.cucumber.java.Scenario;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import qa.justtestlah.configuration.JustTestLahConfiguration;

/** Hook to restart the WebDriver before every test. */
@Component
public class WebDriverHooks extends AbstractCucumberHook {

  private static final Logger LOG = LoggerFactory.getLogger(WebDriverHooks.class);

  @Autowired private JustTestLahConfiguration configuration;

  /**
   * Initialise the web driver.
   *
   * @param scenario Cucumber scenario
   */
  @Override
  public void before(Scenario scenario) {
    LOG.info("Initializing web driver");
    configuration.initWebDriver();
  }

  /**
   * Close the web driver.
   *
   * @param scenario Cucumber scenario
   */
  @Override
  public void after(Scenario scenario) {
    LOG.info("Closing web driver");
    WebDriverRunner.closeWebDriver();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy