use of io.cucumber.junit.PickleRunners.PickleRunner in project cucumber-jvm by cucumber.
the class PickleRunnerWithStepDescriptionsTest method shouldUseStepKeyworkAndNameForChildName.
@Test
void shouldUseStepKeyworkAndNameForChildName() {
List<Pickle> pickles = picklesFromFeature("featurePath", "" + "Feature: feature name\n" + " Scenario: scenario name\n" + " Then it works\n");
PickleRunner runner = PickleRunners.withStepDescriptions(context, pickles.get(0), null, createJunitOptions());
assertEquals("it works", runner.getDescription().getChildren().get(0).getMethodName());
}
use of io.cucumber.junit.PickleRunners.PickleRunner in project cucumber-jvm by cucumber.
the class PickleRunnerWithStepDescriptionsTest method shouldIncludeScenarioNameAsClassNameInStepDescriptions.
@Test
void shouldIncludeScenarioNameAsClassNameInStepDescriptions() {
Feature features = TestPickleBuilder.parseFeature("path/test.feature", "" + "Feature: In cucumber.junit\n" + " Scenario: first\n" + " When step\n" + " Then another step\n" + "\n" + " Scenario: second\n" + " When step\n" + " Then another step\n");
PickleRunner runner = PickleRunners.withStepDescriptions(context, features.getPickles().get(0), null, createJunitOptions());
// fish out the data from runner
Description runnerDescription = runner.getDescription();
Description stepDescription = runnerDescription.getChildren().get(0);
assertEquals("first", stepDescription.getClassName());
assertEquals("step", stepDescription.getMethodName());
assertEquals("step(first)", stepDescription.getDisplayName());
}
use of io.cucumber.junit.PickleRunners.PickleRunner in project cucumber-jvm by cucumber.
the class PickleRunnerWithStepDescriptionsTest method shouldConvertTextFromFeatureFileForNamesWithFilenameCompatibleNameOption.
@Test
void shouldConvertTextFromFeatureFileForNamesWithFilenameCompatibleNameOption() {
List<Pickle> pickles = picklesFromFeature("featurePath", "" + "Feature: feature name\n" + " Scenario: scenario name\n" + " Then it works\n");
PickleRunner runner = PickleRunners.withStepDescriptions(context, pickles.get(0), null, createFileNameCompatibleJunitOptions());
assertEquals("scenario_name", runner.getDescription().getDisplayName());
assertEquals("scenario_name", runner.getDescription().getChildren().get(0).getClassName());
assertEquals("it_works", runner.getDescription().getChildren().get(0).getMethodName());
}
use of io.cucumber.junit.PickleRunners.PickleRunner in project cucumber-jvm by cucumber.
the class PickleRunnerWithNoStepDescriptionsTest method shouldConvertTextFromFeatureFileWithRussianLanguage.
@Test
void shouldConvertTextFromFeatureFileWithRussianLanguage() {
List<Pickle> pickles = TestPickleBuilder.picklesFromFeature("featurePath", "" + "#language:ru\n" + "Функция: имя функции\n" + " Сценарий: имя сценария\n" + " Тогда он работает\n");
PickleRunner runner = PickleRunners.withNoStepDescriptions("имя функции", context, pickles.get(0), null, createFileNameCompatibleJUnitOptions());
assertThat(runner.getDescription().getDisplayName(), is(equalTo("____________(___________)")));
}
use of io.cucumber.junit.PickleRunners.PickleRunner in project cucumber-jvm by cucumber.
the class PickleRunnerWithNoStepDescriptionsTest method shouldUseScenarioNameWithFeatureNameAsClassNameForDisplayName.
@Test
void shouldUseScenarioNameWithFeatureNameAsClassNameForDisplayName() {
List<Pickle> pickles = TestPickleBuilder.picklesFromFeature("featurePath", "" + "Feature: feature name\n" + " Scenario: scenario name\n" + " Then it works\n");
PickleRunner runner = PickleRunners.withNoStepDescriptions("feature name", context, pickles.get(0), null, createJunitOptions());
assertThat(runner.getDescription().getDisplayName(), is(equalTo("scenario name(feature name)")));
}
Aggregations