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();
}
Aggregations