Search in sources :

Example 1 with FileResourceLoader

use of cucumber.runtime.io.FileResourceLoader in project cucumber-jvm by cucumber.

the class CalculatorTest method cucumber.

@Test
public void cucumber() throws Exception {
    assertNotNull(injector);
    assertNotNull(bundleContext);
    final ResourceLoader resourceLoader = new FileResourceLoader();
    final ClassLoader classLoader = Runtime.class.getClassLoader();
    final ObjectFactory objectFactory = new PaxExamObjectFactory(injector);
    final ClassFinder classFinder = new OsgiClassFinder(bundleContext);
    final Backend backend = new JavaBackend(objectFactory, classFinder);
    final RuntimeOptionsFactory runtimeOptionsFactory = new RuntimeOptionsFactory(getClass());
    final RuntimeOptions runtimeOptions = runtimeOptionsFactory.create();
    final Runtime runtime = new Runtime(resourceLoader, classLoader, Collections.singleton(backend), runtimeOptions);
    runtime.run();
    if (!runtime.getErrors().isEmpty()) {
        throw new CucumberException(runtime.getErrors().get(0));
    } else if (runtime.exitStatus() != 0x00) {
        throw new CucumberException("There are pending or undefined steps.");
    }
    assertEquals(runtime.getErrors().size(), 0);
}
Also used : ResourceLoader(cucumber.runtime.io.ResourceLoader) FileResourceLoader(cucumber.runtime.io.FileResourceLoader) JavaBackend(cucumber.runtime.java.JavaBackend) OsgiClassFinder(cucumber.java.runtime.osgi.OsgiClassFinder) Backend(cucumber.runtime.Backend) JavaBackend(cucumber.runtime.java.JavaBackend) Runtime(cucumber.runtime.Runtime) ObjectFactory(cucumber.api.java.ObjectFactory) PaxExamObjectFactory(cucumber.java.runtime.osgi.PaxExamObjectFactory) FileResourceLoader(cucumber.runtime.io.FileResourceLoader) PaxExamObjectFactory(cucumber.java.runtime.osgi.PaxExamObjectFactory) ClassFinder(cucumber.runtime.ClassFinder) OsgiClassFinder(cucumber.java.runtime.osgi.OsgiClassFinder) CucumberException(cucumber.runtime.CucumberException) RuntimeOptionsFactory(cucumber.runtime.RuntimeOptionsFactory) RuntimeOptions(cucumber.runtime.RuntimeOptions) Test(org.junit.Test)

Aggregations

ObjectFactory (cucumber.api.java.ObjectFactory)1 OsgiClassFinder (cucumber.java.runtime.osgi.OsgiClassFinder)1 PaxExamObjectFactory (cucumber.java.runtime.osgi.PaxExamObjectFactory)1 Backend (cucumber.runtime.Backend)1 ClassFinder (cucumber.runtime.ClassFinder)1 CucumberException (cucumber.runtime.CucumberException)1 Runtime (cucumber.runtime.Runtime)1 RuntimeOptions (cucumber.runtime.RuntimeOptions)1 RuntimeOptionsFactory (cucumber.runtime.RuntimeOptionsFactory)1 FileResourceLoader (cucumber.runtime.io.FileResourceLoader)1 ResourceLoader (cucumber.runtime.io.ResourceLoader)1 JavaBackend (cucumber.runtime.java.JavaBackend)1 Test (org.junit.Test)1