use of gherkin.formatter.model.Step in project cucumber-jvm by cucumber.
the class JUnitReporterTest method forward_calls_to_formatter_interface_methods.
@Test
public void forward_calls_to_formatter_interface_methods() throws Exception {
String uri = "uri";
Feature feature = mock(Feature.class);
Background background = mock(Background.class);
ScenarioOutline scenarioOutline = mock(ScenarioOutline.class);
Examples examples = mock(Examples.class);
Scenario scenario = mock(Scenario.class);
Step step = mock(Step.class);
Formatter formatter = mock(Formatter.class);
jUnitReporter = new JUnitReporter(mock(Reporter.class), formatter, false, new JUnitOptions(Collections.<String>emptyList()));
jUnitReporter.uri(uri);
jUnitReporter.feature(feature);
jUnitReporter.scenarioOutline(scenarioOutline);
jUnitReporter.examples(examples);
jUnitReporter.startOfScenarioLifeCycle(scenario);
jUnitReporter.background(background);
jUnitReporter.scenario(scenario);
jUnitReporter.step(step);
jUnitReporter.endOfScenarioLifeCycle(scenario);
jUnitReporter.eof();
jUnitReporter.done();
jUnitReporter.close();
verify(formatter).uri(uri);
verify(formatter).feature(feature);
verify(formatter).scenarioOutline(scenarioOutline);
verify(formatter).examples(examples);
verify(formatter).startOfScenarioLifeCycle(scenario);
;
verify(formatter).background(background);
verify(formatter).scenario(scenario);
verify(formatter).step(step);
verify(formatter).endOfScenarioLifeCycle(scenario);
verify(formatter).eof();
verify(formatter).done();
verify(formatter).close();
}
use of gherkin.formatter.model.Step in project cucumber-jvm by cucumber.
the class TestNgReporter method logResult.
private void logResult(Result result) {
String timing = computeTiming(result);
Step step;
if (steps.isEmpty()) {
step = new Step(null, "MISMATCH BETWEEN STEPS AND RESULTS", "", 0, null, null);
} else {
step = steps.pop();
}
String format = "%s %s (%s%s)";
String message = String.format(format, step.getKeyword(), step.getName(), result.getStatus(), timing);
logDiv(message, "result");
}
use of gherkin.formatter.model.Step in project intellij-plugins by JetBrains.
the class Java8StepDefinitionCreator method buildStepDefinitionByStep.
private static PsiElement buildStepDefinitionByStep(@NotNull final GherkinStep step, Language language) {
final Step cucumberStep = new Step(new ArrayList<>(), step.getKeyword().getText(), step.getStepName(), 0, null, null);
final SnippetGenerator generator = new SnippetGenerator(new Java8Snippet());
final String snippet = generator.getSnippet(cucumberStep, new FunctionNameGenerator(new CamelCaseConcatenator())).replace("PendingException", CucumberJavaUtil.getCucumberPendingExceptionFqn(step)).replaceAll("\\\\\\\\", "\\\\").replaceAll("\\\\d", "\\\\\\\\d");
JVMElementFactory factory = JVMElementFactories.requireFactory(language, step.getProject());
return factory.createExpressionFromText(snippet, step);
}
use of gherkin.formatter.model.Step in project cucumber-jvm by cucumber.
the class ClojureSnippetTest method generatesPlainSnippet.
@Test
public void generatesPlainSnippet() throws Exception {
Step step = new Step(NO_COMMENTS, "Given ", "I have 4 cukes in my \"big\" belly", 0, null, null);
String snippet = newBackend().getSnippet(step, null);
String expected = "" + "(Given #\"^I have (\\d+) cukes in my \\\"([^\\\"]*)\\\" belly$\" [arg1 arg2]\n" + " (comment Write code here that turns the phrase above into concrete actions )\n" + " (throw (cucumber.api.PendingException.)))\n";
assertEquals(expected, snippet);
}
use of gherkin.formatter.model.Step in project cucumber-jvm by cucumber.
the class RuntimeTest method non_strict_with_undefined_steps.
@Test
public void non_strict_with_undefined_steps() {
Runtime runtime = createNonStrictRuntime();
runtime.undefinedStepsTracker.addUndefinedStep(new Step(null, "Given ", "A", 1, null, null), ENGLISH);
assertEquals(0x0, runtime.exitStatus());
}
Aggregations