qa.justtestlah.steps.Hooks Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of justtestlah-core Show documentation
Show all versions of justtestlah-core Show documentation
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.
package qa.justtestlah.steps;
import io.cucumber.java.After;
import io.cucumber.java.Before;
import io.cucumber.java.Scenario;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import qa.justtestlah.configuration.JustTestLahSpringConfig;
import qa.justtestlah.hooks.CucumberHook;
import qa.justtestlah.hooks.HooksRegister;
import qa.justtestlah.hooks.WebDriverHooks;
/** This class registers Cucumber hooks with {@link HooksRegister}. */
@ContextConfiguration(classes = JustTestLahSpringConfig.class)
public class Hooks {
@Autowired private HooksRegister hooksRegister;
@Autowired private WebDriverHooks webDriver;
private void initHooks() {
hooksRegister.addHooks(webDriver);
}
@Before
public void notifyBefore(Scenario scenario) {
initHooks();
for (CucumberHook hook : hooksRegister.getRegisteredHooks()) {
hook.before(scenario);
}
}
@After
public void notifyAfter(Scenario scenario) {
for (CucumberHook hook : hooksRegister.getRegisteredHooks()) {
hook.after(scenario);
}
hooksRegister.clear();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy