Search in sources :

Example 1 with FeaturePathFeatureSupplier

use of cucumber.runtime.FeaturePathFeatureSupplier in project seleniumRobot by bhecquet.

the class CustomTestNGCucumberRunner method initCucumberOptions.

private void initCucumberOptions() throws URISyntaxException {
    String cucumberPkg = SeleniumTestsContextManager.getGlobalContext().getCucmberPkg();
    if (cucumberPkg == null) {
        throw new CustomSeleniumTestsException("'cucumberPackage' parameter is not set in test NG XML file (inside <suite> tag), " + "set it to the root package where cucumber implementation resides");
    }
    RuntimeOptionsBuilder builder = new RuntimeOptionsBuilder();
    // add cucumber implementation classes
    builder.addGlue(new URI("classpath:" + cucumberPkg.replace(".", "/")));
    if (!cucumberPkg.startsWith("com.seleniumtests")) {
        builder.addGlue(new URI("classpath:com/seleniumtests/core/runner/cucumber"));
    }
    // correct issue #243: as we write to log files, colors cannot be rendered in text files
    builder.setMonochrome().addFeature(FeatureWithLines.parse(SeleniumTestsContextManager.getFeaturePath())).addTagFilter(SeleniumTestsContextManager.getThreadContext().getCucumberTags().replace(" AND ", // for compatibility with old format
    " and "));
    for (String cucumberTest : SeleniumTestsContextManager.getThreadContext().getCucumberTests()) {
        builder.addNameFilter(Pattern.compile(cucumberTest.replace("??", // Handle special regex character '?' as we
        "\\?\\?")));
    }
    runtimeOptions = builder.build();
    runtimeOptions.addUndefinedStepsPrinterIfSummaryNotDefined();
    ClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader);
    BackendModuleBackendSupplier backendSupplier = new BackendModuleBackendSupplier(resourceLoader, classFinder, runtimeOptions);
    bus = new TimeServiceEventBus(TimeService.SYSTEM);
    plugins = new Plugins(classLoader, new PluginFactory(), runtimeOptions);
    FeatureLoader featureLoader = new FeatureLoader(resourceLoader);
    filters = new Filters(runtimeOptions);
    this.runnerSupplier = new ThreadLocalRunnerSupplier(runtimeOptions, bus, backendSupplier);
    featureSupplier = new FeaturePathFeatureSupplier(featureLoader, runtimeOptions);
}
Also used : BackendModuleBackendSupplier(cucumber.runtime.BackendModuleBackendSupplier) CustomSeleniumTestsException(com.seleniumtests.customexception.CustomSeleniumTestsException) RuntimeOptionsBuilder(io.cucumber.core.options.RuntimeOptionsBuilder) URI(java.net.URI) TimeServiceEventBus(cucumber.runner.TimeServiceEventBus) ThreadLocalRunnerSupplier(cucumber.runner.ThreadLocalRunnerSupplier) ResourceLoaderClassFinder(cucumber.runtime.io.ResourceLoaderClassFinder) Filters(cucumber.runtime.filter.Filters) FeaturePathFeatureSupplier(cucumber.runtime.FeaturePathFeatureSupplier) ResourceLoaderClassFinder(cucumber.runtime.io.ResourceLoaderClassFinder) ClassFinder(cucumber.runtime.ClassFinder) PluginFactory(cucumber.runtime.formatter.PluginFactory) FeatureLoader(cucumber.runtime.model.FeatureLoader) Plugins(cucumber.runtime.formatter.Plugins)

Aggregations

CustomSeleniumTestsException (com.seleniumtests.customexception.CustomSeleniumTestsException)1 ThreadLocalRunnerSupplier (cucumber.runner.ThreadLocalRunnerSupplier)1 TimeServiceEventBus (cucumber.runner.TimeServiceEventBus)1 BackendModuleBackendSupplier (cucumber.runtime.BackendModuleBackendSupplier)1 ClassFinder (cucumber.runtime.ClassFinder)1 FeaturePathFeatureSupplier (cucumber.runtime.FeaturePathFeatureSupplier)1 Filters (cucumber.runtime.filter.Filters)1 PluginFactory (cucumber.runtime.formatter.PluginFactory)1 Plugins (cucumber.runtime.formatter.Plugins)1 ResourceLoaderClassFinder (cucumber.runtime.io.ResourceLoaderClassFinder)1 FeatureLoader (cucumber.runtime.model.FeatureLoader)1 RuntimeOptionsBuilder (io.cucumber.core.options.RuntimeOptionsBuilder)1 URI (java.net.URI)1