Skip to content

Commit ddfc088

Browse files
baevArtem Eroshenko
authored andcommitted
add test for dry run (via #262)
1 parent 37853fd commit ddfc088

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

allure-cucumber3-jvm/src/test/java/io/qameta/allure/cucumber3jvm/AllureCucumber3JvmTest.java

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import java.io.InputStream;
3434
import java.nio.charset.StandardCharsets;
3535
import java.time.Instant;
36+
import java.util.ArrayList;
3637
import java.util.Arrays;
3738
import java.util.Collection;
3839
import java.util.List;
@@ -337,18 +338,34 @@ void shouldProcessNotImplementedScenario() throws IOException {
337338
.containsExactlyInAnyOrder((Status) null);
338339
}
339340

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+
340354
private void runFeature(final AllureResultsWriterStub writer,
341-
final String featureResource) throws IOException {
355+
final String featureResource,
356+
final String... moreOptions) throws IOException {
342357

343358
final AllureLifecycle lifecycle = new AllureLifecycle(writer);
344359
final AllureCucumber3Jvm cucumber3Jvm = new AllureCucumber3Jvm(lifecycle);
345360
final ClassLoader classLoader = currentThread().getContextClassLoader();
346361
final ResourceLoader resourceLoader = new MultiLoader(classLoader);
347362
final ClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader);
348-
final RuntimeOptions options = new RuntimeOptions(Arrays.asList(
363+
final List<String> opts = new ArrayList<>(Arrays.asList(
349364
"--glue", "io.qameta.allure.cucumber3jvm.samples",
350365
"--plugin", "null"
351366
));
367+
opts.addAll(Arrays.asList(moreOptions));
368+
final RuntimeOptions options = new RuntimeOptions(opts);
352369
final Runtime runtime = new Runtime(resourceLoader, classFinder, classLoader, options);
353370

354371
options.addPlugin(cucumber3Jvm);

0 commit comments

Comments
 (0)