Skip to content

Commit f7707a1

Browse files
committed
Add tests
1 parent 4a17652 commit f7707a1

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

junit/src/test/java/io/cucumber/junit/FeatureRunnerTest.java

+29
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import io.cucumber.core.filter.Filters;
55
import io.cucumber.core.gherkin.Feature;
66
import io.cucumber.core.options.RuntimeOptions;
7+
import io.cucumber.core.options.RuntimeOptionsBuilder;
78
import io.cucumber.core.runtime.BackendSupplier;
89
import io.cucumber.core.runtime.ObjectFactoryServiceLoader;
910
import io.cucumber.core.runtime.ObjectFactorySupplier;
@@ -12,6 +13,7 @@
1213
import io.cucumber.core.runtime.SingletonObjectFactorySupplier;
1314
import io.cucumber.core.runtime.ThreadLocalRunnerSupplier;
1415
import io.cucumber.core.runtime.TimeServiceEventBus;
16+
import io.cucumber.tagexpressions.TagExpressionParser;
1517
import org.junit.jupiter.api.Test;
1618
import org.junit.runner.Description;
1719
import org.junit.runner.notification.Failure;
@@ -383,4 +385,31 @@ void should_notify_of_failure_to_create_runners_and_request_test_execution_to_st
383385
order.verify(notifier).fireTestFinished(description);
384386
}
385387

388+
@Test
389+
void should_filter_pickles() {
390+
Feature feature = TestPickleBuilder.parseFeature("path/test.feature", "" +
391+
"Feature: feature name\n" +
392+
" Scenario: scenario_1 name\n" +
393+
" Given step #1\n" +
394+
" @tag\n" +
395+
" Scenario: scenario_2 name\n" +
396+
" Given step #1\n"
397+
398+
);
399+
400+
RuntimeOptions options = new RuntimeOptionsBuilder()
401+
.addTagFilter(TagExpressionParser.parse("@tag"))
402+
.build();
403+
Filters filters = new Filters(options);
404+
405+
IllegalStateException illegalStateException = new IllegalStateException();
406+
RunnerSupplier runnerSupplier = () -> {
407+
throw illegalStateException;
408+
};
409+
410+
FeatureRunner featureRunner = FeatureRunner.create(feature, null, filters, runnerSupplier, new JUnitOptions());
411+
assertThat(featureRunner.getChildren().size(), is(1));
412+
assertThat(featureRunner.getChildren().get(0).getDescription().getDisplayName(), is("scenario_2 name(feature name)"));
413+
}
414+
386415
}

0 commit comments

Comments
 (0)