|
33 | 33 | import java.io.InputStream; |
34 | 34 | import java.nio.charset.StandardCharsets; |
35 | 35 | import java.time.Instant; |
| 36 | +import java.util.ArrayList; |
36 | 37 | import java.util.Arrays; |
37 | 38 | import java.util.Collection; |
38 | 39 | import java.util.List; |
@@ -337,18 +338,34 @@ void shouldProcessNotImplementedScenario() throws IOException { |
337 | 338 | .containsExactlyInAnyOrder((Status) null); |
338 | 339 | } |
339 | 340 |
|
| 341 | + @Test |
| 342 | + void shouldSupportDryRun() throws IOException { |
| 343 | + final AllureResultsWriterStub writer = new AllureResultsWriterStub(); |
| 344 | + runFeature(writer, "features/simple.feature", "--dry-run"); |
| 345 | + |
| 346 | + final List<TestResult> testResults = writer.getTestResults(); |
| 347 | + assertThat(testResults) |
| 348 | + .extracting(TestResult::getName, TestResult::getStatus) |
| 349 | + .containsExactlyInAnyOrder( |
| 350 | + tuple("Add a to b", Status.SKIPPED) |
| 351 | + ); |
| 352 | + } |
| 353 | + |
340 | 354 | private void runFeature(final AllureResultsWriterStub writer, |
341 | | - final String featureResource) throws IOException { |
| 355 | + final String featureResource, |
| 356 | + final String... moreOptions) throws IOException { |
342 | 357 |
|
343 | 358 | final AllureLifecycle lifecycle = new AllureLifecycle(writer); |
344 | 359 | final AllureCucumber3Jvm cucumber3Jvm = new AllureCucumber3Jvm(lifecycle); |
345 | 360 | final ClassLoader classLoader = currentThread().getContextClassLoader(); |
346 | 361 | final ResourceLoader resourceLoader = new MultiLoader(classLoader); |
347 | 362 | final ClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader); |
348 | | - final RuntimeOptions options = new RuntimeOptions(Arrays.asList( |
| 363 | + final List<String> opts = new ArrayList<>(Arrays.asList( |
349 | 364 | "--glue", "io.qameta.allure.cucumber3jvm.samples", |
350 | 365 | "--plugin", "null" |
351 | 366 | )); |
| 367 | + opts.addAll(Arrays.asList(moreOptions)); |
| 368 | + final RuntimeOptions options = new RuntimeOptions(opts); |
352 | 369 | final Runtime runtime = new Runtime(resourceLoader, classFinder, classLoader, options); |
353 | 370 |
|
354 | 371 | options.addPlugin(cucumber3Jvm); |
|
0 commit comments