use of io.cucumber.core.options.RuntimeOptionsBuilder in project cucumber-jvm by cucumber.
the class PrettyFormatterTest method should_print_output_from_afterStep_hooks.
@Test
void should_print_output_from_afterStep_hooks() {
Feature feature = TestFeatureParser.parse("path/test.feature", "" + "Feature: feature name\n" + " Scenario: scenario name\n" + " Given first step\n" + " When second step\n");
ByteArrayOutputStream out = new ByteArrayOutputStream();
Runtime.builder().withFeatureSupplier(new StubFeatureSupplier(feature)).withAdditionalPlugins(new PrettyFormatter(out)).withRuntimeOptions(new RuntimeOptionsBuilder().setMonochrome().build()).withBackendSupplier(new StubBackendSupplier(emptyList(), emptyList(), asList(new StubStepDefinition("first step", "path/step_definitions.java:3"), new StubStepDefinition("second step", "path/step_definitions.java:4")), singletonList(new StubHookDefinition(testCaseState -> testCaseState.log("printed from afterstep hook"))), emptyList())).build().run();
assertThat(out, bytesContainsString("" + " Given first step # path/step_definitions.java:3\n" + "\n" + " printed from afterstep hook\n" + "\n" + " When second step # path/step_definitions.java:4\n" + "\n" + " printed from afterstep hook" + "\n"));
}
use of io.cucumber.core.options.RuntimeOptionsBuilder in project cucumber-jvm by cucumber.
the class PrettyFormatterTest method should_print_error_message_for_after_hooks.
@Test
void should_print_error_message_for_after_hooks() {
Feature feature = TestFeatureParser.parse("path/test.feature", "" + "Feature: feature name\n" + " Scenario: scenario name\n" + " Given first step\n");
ByteArrayOutputStream out = new ByteArrayOutputStream();
Runtime.builder().withFeatureSupplier(new StubFeatureSupplier(feature)).withAdditionalPlugins(new PrettyFormatter(out)).withRuntimeOptions(new RuntimeOptionsBuilder().setMonochrome().build()).withBackendSupplier(new StubBackendSupplier(emptyList(), singletonList(new StubStepDefinition("first step", "path/step_definitions.java:3")), singletonList(new StubHookDefinition(new StubException())))).build().run();
assertThat(out, bytesContainsString("" + " Given first step # path/step_definitions.java:3\n" + " the stack trace\n"));
}
use of io.cucumber.core.options.RuntimeOptionsBuilder in project cucumber-jvm by cucumber.
the class DryRunTest method dry_run_passes_pending_step.
@Test
void dry_run_passes_pending_step() {
Feature pending = TestFeatureParser.parse("2/pending.feature", "Feature: pending\n" + " Scenario: pending\n" + " * pending step\n");
StepStatusSpy out = new StepStatusSpy();
Runtime.builder().withFeatureSupplier(new StubFeatureSupplier(pending)).withAdditionalPlugins(out).withBackendSupplier(backend).withRuntimeOptions(new RuntimeOptionsBuilder().setDryRun().build()).build().run();
assertThat(out.toString(), is("" + "pending\n" + " PASSED\n"));
}
use of io.cucumber.core.options.RuntimeOptionsBuilder in project cucumber-jvm by cucumber.
the class DryRunTest method dry_run_skips_all_steps_after_undefined_step.
@Test
void dry_run_skips_all_steps_after_undefined_step() {
StepStatusSpy out = new StepStatusSpy();
Runtime.builder().withFeatureSupplier(new StubFeatureSupplier(undefined)).withAdditionalPlugins(out).withBackendSupplier(backend).withRuntimeOptions(new RuntimeOptionsBuilder().setDryRun().build()).build().run();
assertThat(out.toString(), is("" + "undefined\n" + " UNDEFINED\n" + " SKIPPED\n" + " SKIPPED\n" + " SKIPPED\n" + " SKIPPED\n" + " SKIPPED\n" + " SKIPPED\n"));
}
use of io.cucumber.core.options.RuntimeOptionsBuilder in project cucumber-jvm by cucumber.
the class JsonFormatterTest method featureWithOutlineTestParallel.
@Test
void featureWithOutlineTestParallel() {
ByteArrayOutputStream out = new ByteArrayOutputStream();
createRuntime(out).withRuntimeOptions(new RuntimeOptionsBuilder().setThreads(2).build()).build().run();
InputStream resourceAsStream = getClass().getResourceAsStream("JsonPrettyFormatterTest.json");
String expected = new Scanner(resourceAsStream, "UTF-8").useDelimiter("\\A").next();
assertJsonEquals(expected, out);
}
Aggregations