use of cucumber.runtime.io.ResourceLoader in project cucumber-jvm by cucumber.
the class CucumberFeatureTest method loads_no_features_when_rerun_file_is_empty.
@Test
public void loads_no_features_when_rerun_file_is_empty() throws Exception {
String feature = "" + "Feature: bar\n" + " Scenario: scenario bar\n" + " * step\n";
String rerunPath = "path/rerun.txt";
String rerunFile = "";
ResourceLoader resourceLoader = mockFeatureFileResourceForAnyFeaturePath(feature);
mockFileResource(resourceLoader, rerunPath, null, rerunFile);
List<CucumberFeature> features = CucumberFeature.load(resourceLoader, singletonList("@" + rerunPath), new ArrayList<Object>(), new PrintStream(new ByteArrayOutputStream()));
assertEquals(0, features.size());
}
use of cucumber.runtime.io.ResourceLoader in project cucumber-jvm by cucumber.
the class CucumberFeatureTest method applies_line_filters_when_loading_a_feature.
@Test
public void applies_line_filters_when_loading_a_feature() throws Exception {
String featurePath = "path/foo.feature";
String feature = "" + "Feature: foo\n" + " Scenario: scenario 1\n" + " * step\n" + " Scenario: scenario 2\n" + " * step\n";
ResourceLoader resourceLoader = mockFeatureFileResource(featurePath, feature);
List<CucumberFeature> features = CucumberFeature.load(resourceLoader, singletonList(featurePath + ":2"), new ArrayList<Object>(), new PrintStream(new ByteArrayOutputStream()));
assertEquals(1, features.size());
assertEquals(1, features.get(0).getFeatureElements().size());
assertEquals("Scenario: scenario 1", features.get(0).getFeatureElements().get(0).getVisualName());
}
use of cucumber.runtime.io.ResourceLoader in project cucumber-jvm by cucumber.
the class CucumberFeatureTest method loads_features_specified_in_rerun_file.
@Test
public void loads_features_specified_in_rerun_file() throws Exception {
String featurePath1 = "path/bar.feature";
String feature1 = "" + "Feature: bar\n" + " Scenario: scenario bar\n" + " * step\n";
String featurePath2 = "path/foo.feature";
String feature2 = "" + "Feature: foo\n" + " Scenario: scenario 1\n" + " * step\n" + " Scenario: scenario 2\n" + " * step\n";
String rerunPath = "path/rerun.txt";
String rerunFile = featurePath1 + ":2 " + featurePath2 + ":4";
ResourceLoader resourceLoader = mockFeatureFileResource(featurePath1, feature1);
mockFeatureFileResource(resourceLoader, featurePath2, feature2);
mockFileResource(resourceLoader, rerunPath, null, rerunFile);
List<CucumberFeature> features = CucumberFeature.load(resourceLoader, singletonList("@" + rerunPath), new ArrayList<Object>(), new PrintStream(new ByteArrayOutputStream()));
assertEquals(2, features.size());
assertEquals(1, features.get(0).getFeatureElements().size());
assertEquals("Scenario: scenario bar", features.get(0).getFeatureElements().get(0).getVisualName());
assertEquals(1, features.get(1).getFeatureElements().size());
assertEquals("Scenario: scenario 2", features.get(1).getFeatureElements().get(0).getVisualName());
}
use of cucumber.runtime.io.ResourceLoader in project activityinfo by bedatadriven.
the class ScenarioTestCase method createCucumberRuntime.
private Runtime createCucumberRuntime() {
List<Module> moduleList = new ArrayList<>();
moduleList.add(new ScenarioModule(new SequentialScenarioScope()));
moduleList.addAll(testConditions.getModules());
Injector injector = Guice.createInjector(moduleList);
ClassLoader classLoader = getClass().getClassLoader();
ResourceLoader resourceLoader = new MultiLoader(classLoader);
ClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader);
JavaBackend backend = new JavaBackend(new GuiceObjectFactory(injector), classFinder);
return new Runtime(resourceLoader, classLoader, Collections.singleton(backend), options);
}
use of cucumber.runtime.io.ResourceLoader in project activityinfo by bedatadriven.
the class TestMain method queueOdkTests.
private void queueOdkTests() {
ResourceLoader loader = new MultiLoader(getClass().getClassLoader());
RuntimeOptions options = new RuntimeOptions(Arrays.asList("--tags", "@odk", "classpath:org/activityinfo/test", "--glue", "org.activityinfo.test.steps.common", "--glue", "org.activityinfo.test.steps.odk"));
queueFeatures("odk", loader, options, new OdkModule());
}
Aggregations