use of io.cucumber.junit.PickleRunners.WithStepDescriptions in project cucumber-jvm by cucumber.
the class PickleRunnerWithStepDescriptionsTest method shouldAssignUnequalDescriptionsToDifferentOccurrencesOfSameStepInAScenario.
@Test
void shouldAssignUnequalDescriptionsToDifferentOccurrencesOfSameStepInAScenario() {
List<Pickle> pickles = picklesFromFeature("path/test.feature", "" + "Feature: FB\n" + "# Scenario with same step occurring twice\n" + "\n" + " Scenario: SB\n" + " When foo\n" + " Then bar\n" + "\n" + " When foo\n" + " Then baz\n");
WithStepDescriptions runner = (WithStepDescriptions) PickleRunners.withStepDescriptions(context, pickles.get(0), null, createJunitOptions());
// fish out the two occurrences of the same step and check whether we
// really got them
Step stepOccurrence1 = runner.getChildren().get(0);
Step stepOccurrence2 = runner.getChildren().get(2);
assertEquals(stepOccurrence1.getText(), stepOccurrence2.getText());
// then check that the descriptions are unequal
Description runnerDescription = runner.getDescription();
Description stepDescription1 = runnerDescription.getChildren().get(0);
Description stepDescription2 = runnerDescription.getChildren().get(2);
assertNotEquals(stepDescription1, stepDescription2);
}
use of io.cucumber.junit.PickleRunners.WithStepDescriptions in project cucumber-jvm by cucumber.
the class PickleRunnerWithStepDescriptionsTest method shouldAssignUnequalDescriptionsToDifferentStepsInAScenarioOutline.
@Test
void shouldAssignUnequalDescriptionsToDifferentStepsInAScenarioOutline() {
Feature features = TestPickleBuilder.parseFeature("path/test.feature", "" + "Feature: FB\n" + " Scenario Outline: SO\n" + " When <action>\n" + " Then <result>\n" + " Examples:\n" + " | action | result |\n" + " | a1 | r1 |\n");
WithStepDescriptions runner = (WithStepDescriptions) PickleRunners.withStepDescriptions(context, features.getPickles().get(0), null, createJunitOptions());
Description runnerDescription = runner.getDescription();
Description stepDescription1 = runnerDescription.getChildren().get(0);
Description stepDescription2 = runnerDescription.getChildren().get(1);
assertNotEquals(stepDescription1, stepDescription2);
}
Aggregations