use of gherkin.formatter.model.Step in project cucumber-jvm by cucumber.
the class UndefinedStepsTrackerTest method removes_duplicates.
@Test
public void removes_duplicates() {
Backend backend = new TestBackend();
UndefinedStepsTracker tracker = new UndefinedStepsTracker();
tracker.storeStepKeyword(new Step(null, "Given ", "A", 1, null, null), ENGLISH);
tracker.addUndefinedStep(new Step(null, "Given ", "B", 1, null, null), ENGLISH);
tracker.addUndefinedStep(new Step(null, "Given ", "B", 1, null, null), ENGLISH);
assertEquals("[Given ^B$]", tracker.getSnippets(asList(backend), functionNameGenerator).toString());
}
use of gherkin.formatter.model.Step in project cucumber-jvm by cucumber.
the class UndefinedStepsTrackerTest method star_keyword_becomes_given_when_no_previous_step.
@Test
public void star_keyword_becomes_given_when_no_previous_step() {
Backend backend = new TestBackend();
UndefinedStepsTracker tracker = new UndefinedStepsTracker();
tracker.addUndefinedStep(new Step(null, "* ", "A", 1, null, null), ENGLISH);
assertEquals("[Given ^A$]", tracker.getSnippets(asList(backend), functionNameGenerator).toString());
}
use of gherkin.formatter.model.Step in project cucumber-jvm by cucumber.
the class UndefinedStepsTrackerTest method snippets_are_generated_for_correct_locale.
@Test
public void snippets_are_generated_for_correct_locale() throws Exception {
Backend backend = new TestBackend();
UndefinedStepsTracker tracker = new UndefinedStepsTracker();
tracker.addUndefinedStep(new Step(null, "Если ", "Б", 1, null, null), new I18n("ru"));
assertEquals("[Если ^Б$]", tracker.getSnippets(asList(backend), functionNameGenerator).toString());
}
use of gherkin.formatter.model.Step in project cucumber-jvm by cucumber.
the class StepDefinitionMatchTest method gives_nice_error_message_when_conversion_fails.
@Test
public void gives_nice_error_message_when_conversion_fails() throws Throwable {
StepDefinition stepDefinition = mock(StepDefinition.class);
when(stepDefinition.getParameterCount()).thenReturn(1);
when(stepDefinition.getParameterType(0, String.class)).thenReturn(new ParameterInfo(Thang.class, null, null, null));
Step stepWithoutDocStringOrTable = mock(Step.class);
when(stepWithoutDocStringOrTable.getDocString()).thenReturn(null);
when(stepWithoutDocStringOrTable.getRows()).thenReturn(null);
StepDefinitionMatch stepDefinitionMatch = new StepDefinitionMatch(Arrays.asList(new Argument(0, "blah")), stepDefinition, "some.feature", stepWithoutDocStringOrTable, new LocalizedXStreams(classLoader));
try {
stepDefinitionMatch.runStep(ENGLISH);
fail();
} catch (CucumberException expected) {
assertEquals("Don't know how to convert \"blah\" into cucumber.runtime.StepDefinitionMatchTest$Thang.\n" + "Try writing your own converter:\n" + "\n" + "@cucumber.deps.com.thoughtworks.xstream.annotations.XStreamConverter(ThangConverter.class)\n" + "public class Thang {}\n", expected.getMessage());
}
}
use of gherkin.formatter.model.Step in project cucumber-jvm by cucumber.
the class CucumberScenarioOutlineTest method replaces_tokens_in_step_names.
@Test
public void replaces_tokens_in_step_names() {
Step outlineStep = new Step(C, null, "I have <n> cukes", 0, null, null);
Step exampleStep = CucumberScenarioOutline.createExampleStep(outlineStep, new ExamplesTableRow(C, asList("n"), 1, ""), new ExamplesTableRow(C, asList("10"), 1, ""));
assertEquals("I have 10 cukes", exampleStep.getName());
}
Aggregations