Search in sources :

Example 1 with WebDriverSession

use of org.activityinfo.test.webdriver.WebDriverSession in project activityinfo by bedatadriven.

the class JUnitUiTestCase method call.

@Override
public TestResult call() throws Exception {
    List<Module> modules = Lists.newArrayList();
    modules.add(new ScenarioModule(new SequentialScenarioScope()));
    modules.addAll(testConditions.getModules());
    Injector injector = Guice.createInjector(modules);
    injector.getInstance(ScenarioScope.class).enterScope();
    WebDriverSession session = injector.getInstance(WebDriverSession.class);
    session.beforeTest(getId());
    Object testClassInstance = injector.getInstance(testMethod.getDeclaringClass());
    TestResult.Builder result = TestResult.builder(this);
    try {
        testMethod.invoke(testClassInstance);
    } catch (Throwable caught) {
        caught.printStackTrace();
        result.failed();
    } finally {
        result.output().append(TestOutputStream.drainThreadOutput());
        if (session.isRunning()) {
            session.stop();
        }
        injector.getInstance(ScenarioScope.class).exitScope();
    }
    return result.build();
}
Also used : WebDriverSession(org.activityinfo.test.webdriver.WebDriverSession) Injector(com.google.inject.Injector) ScenarioModule(cucumber.runtime.java.guice.impl.ScenarioModule) SequentialScenarioScope(cucumber.runtime.java.guice.impl.SequentialScenarioScope) ScenarioScope(cucumber.runtime.java.guice.ScenarioScope) SequentialScenarioScope(cucumber.runtime.java.guice.impl.SequentialScenarioScope) Module(com.google.inject.Module) ScenarioModule(cucumber.runtime.java.guice.impl.ScenarioModule)

Aggregations

Injector (com.google.inject.Injector)1 Module (com.google.inject.Module)1 ScenarioScope (cucumber.runtime.java.guice.ScenarioScope)1 ScenarioModule (cucumber.runtime.java.guice.impl.ScenarioModule)1 SequentialScenarioScope (cucumber.runtime.java.guice.impl.SequentialScenarioScope)1 WebDriverSession (org.activityinfo.test.webdriver.WebDriverSession)1