|
4 | 4 | import io.cucumber.core.filter.Filters;
|
5 | 5 | import io.cucumber.core.gherkin.Feature;
|
6 | 6 | import io.cucumber.core.options.RuntimeOptions;
|
| 7 | +import io.cucumber.core.options.RuntimeOptionsBuilder; |
7 | 8 | import io.cucumber.core.runtime.BackendSupplier;
|
8 | 9 | import io.cucumber.core.runtime.ObjectFactoryServiceLoader;
|
9 | 10 | import io.cucumber.core.runtime.ObjectFactorySupplier;
|
|
12 | 13 | import io.cucumber.core.runtime.SingletonObjectFactorySupplier;
|
13 | 14 | import io.cucumber.core.runtime.ThreadLocalRunnerSupplier;
|
14 | 15 | import io.cucumber.core.runtime.TimeServiceEventBus;
|
| 16 | +import io.cucumber.tagexpressions.TagExpressionParser; |
15 | 17 | import org.junit.jupiter.api.Test;
|
16 | 18 | import org.junit.runner.Description;
|
17 | 19 | import org.junit.runner.notification.Failure;
|
@@ -383,4 +385,31 @@ void should_notify_of_failure_to_create_runners_and_request_test_execution_to_st
|
383 | 385 | order.verify(notifier).fireTestFinished(description);
|
384 | 386 | }
|
385 | 387 |
|
| 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 | + |
386 | 415 | }
|
0 commit comments