use of io.cucumber.core.runtime.StubFeatureSupplier in project cucumber-jvm by cucumber.
the class RerunFormatterTest method should_put_data_in_report_when_exit_code_is_non_zero.
@Test
void should_put_data_in_report_when_exit_code_is_non_zero() {
Feature feature = TestFeatureParser.parse("classpath:path/test.feature", "" + "Feature: feature name\n" + " Scenario: failed scenario\n" + " Given failed step\n" + " Scenario: pending scenario\n" + " Given pending step\n" + " Scenario: undefined scenario\n" + " Given undefined step\n");
ByteArrayOutputStream out = new ByteArrayOutputStream();
Runtime.builder().withFeatureSupplier(new StubFeatureSupplier(feature)).withAdditionalPlugins(new RerunFormatter(out)).withBackendSupplier(new StubBackendSupplier(new StubStepDefinition("failed step", new StubException()), new StubStepDefinition("pending step", new StubPendingException()))).build().run();
assertThat(out, isBytesEqualTo("classpath:path/test.feature:2:4:6\n"));
}
use of io.cucumber.core.runtime.StubFeatureSupplier in project cucumber-jvm by cucumber.
the class TeamCityPluginTest method should_handle_write_events.
@Test
void should_handle_write_events() {
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 TeamCityPlugin(new PrintStream(out))).withEventBus(new TimeServiceEventBus(fixed(EPOCH, of("UTC")), UUID::randomUUID)).withBackendSupplier(new StubBackendSupplier(singletonList(new StubHookDefinition((TestCaseState state) -> state.log("A message"))), singletonList(new StubStepDefinition("first step")), emptyList())).build().run();
assertThat(out, bytesContainsString("" + "##teamcity[message text='Write event:|nA message|n' status='NORMAL']\n"));
}
use of io.cucumber.core.runtime.StubFeatureSupplier in project cucumber-jvm by cucumber.
the class RerunFormatterTest method should_use_scenario_location_when_after_hook_fails.
@Test
void should_use_scenario_location_when_after_hook_fails() {
Feature feature = TestFeatureParser.parse("classpath:path/test.feature", "" + "Feature: feature name\n" + " Scenario: scenario name\n" + " Given first step\n" + " When second step\n" + " Then third step\n");
ByteArrayOutputStream out = new ByteArrayOutputStream();
Runtime.builder().withFeatureSupplier(new StubFeatureSupplier(feature)).withAdditionalPlugins(new RerunFormatter(out)).withBackendSupplier(new StubBackendSupplier(emptyList(), asList(new StubStepDefinition("first step"), new StubStepDefinition("second step"), new StubStepDefinition("third step")), singletonList(new StubHookDefinition(new StubException())))).build().run();
assertThat(out, isBytesEqualTo("classpath:path/test.feature:2\n"));
}
use of io.cucumber.core.runtime.StubFeatureSupplier in project cucumber-jvm by cucumber.
the class RerunFormatterTest method should_use_scenario_location_when_background_step_fails.
@Test
void should_use_scenario_location_when_background_step_fails() {
Feature feature = TestFeatureParser.parse("path/test.feature", "" + "Feature: feature name\n" + " Background: the background\n" + " Given background step\n" + " Scenario: scenario name\n" + " When second step\n" + " Then third step\n");
ByteArrayOutputStream out = new ByteArrayOutputStream();
Runtime.builder().withFeatureSupplier(new StubFeatureSupplier(feature)).withAdditionalPlugins(new RerunFormatter(out)).withBackendSupplier(new StubBackendSupplier(new StubStepDefinition("background step", new StubException()), new StubStepDefinition("second step"), new StubStepDefinition("third step"))).build().run();
assertThat(out, isBytesEqualTo("file:path/test.feature:4\n"));
}
use of io.cucumber.core.runtime.StubFeatureSupplier in project cucumber-jvm by cucumber.
the class RerunFormatterTest method should_one_entry_for_feature_with_many_failing_scenarios.
@Test
void should_one_entry_for_feature_with_many_failing_scenarios() {
Feature feature = TestFeatureParser.parse("classpath:path/test.feature", "" + "Feature: feature name\n" + " Scenario: scenario 1 name\n" + " When first step\n" + " Then second step\n" + " Scenario: scenario 2 name\n" + " When third step\n" + " Then forth step\n");
ByteArrayOutputStream out = new ByteArrayOutputStream();
Runtime.builder().withFeatureSupplier(new StubFeatureSupplier(feature)).withAdditionalPlugins(new RerunFormatter(out)).withBackendSupplier(new StubBackendSupplier(new StubStepDefinition("first step"), new StubStepDefinition("second step", new StubException()), new StubStepDefinition("third step", new StubException()), new StubStepDefinition("forth step"))).build().run();
assertThat(out, isBytesEqualTo("classpath:path/test.feature:2:5\n"));
}
Aggregations