use of gherkin.formatter.model.Step in project cucumber-jvm by cucumber.
the class RuntimeTest method strict_with_undefined_steps.
@Test
public void strict_with_undefined_steps() {
Runtime runtime = createStrictRuntime();
runtime.undefinedStepsTracker.addUndefinedStep(new Step(null, "Given ", "A", 1, null, null), ENGLISH);
assertEquals(0x1, runtime.exitStatus());
}
use of gherkin.formatter.model.Step in project cucumber-jvm by cucumber.
the class Runtime method runUnreportedStep.
//TODO: Maybe this should go into the cucumber step execution model and it should return the result of that execution!
@Override
public void runUnreportedStep(String featurePath, I18n i18n, String stepKeyword, String stepName, int line, List<DataTableRow> dataTableRows, DocString docString) throws Throwable {
Step step = new Step(Collections.<Comment>emptyList(), stepKeyword, stepName, line, dataTableRows, docString);
StepDefinitionMatch match = glue.stepDefinitionMatch(featurePath, step, i18n);
if (match == null) {
UndefinedStepException error = new UndefinedStepException(step);
StackTraceElement[] originalTrace = error.getStackTrace();
StackTraceElement[] newTrace = new StackTraceElement[originalTrace.length + 1];
newTrace[0] = new StackTraceElement("✽", "StepDefinition", featurePath, line);
System.arraycopy(originalTrace, 0, newTrace, 1, originalTrace.length);
error.setStackTrace(newTrace);
throw error;
}
match.runStep(i18n);
}
use of gherkin.formatter.model.Step in project cucumber-jvm by cucumber.
the class JUnitReporterTest method mockStep.
private Step mockStep(String stepName) {
Step step = mock(Step.class);
when(step.getName()).thenReturn(stepName);
return step;
}
use of gherkin.formatter.model.Step in project cucumber-jvm by cucumber.
the class JUnitReporterTest method match_allow_stared_ignored.
@Test
public void match_allow_stared_ignored() {
createAllowStartedIgnoredReporter();
Step runnerStep = mockStep();
Description runnerStepDescription = stepDescription(runnerStep);
ExecutionUnitRunner executionUnitRunner = mockExecutionUnitRunner(runnerSteps(runnerStep));
when(executionUnitRunner.describeChild(runnerStep)).thenReturn(runnerStepDescription);
runNotifier = mock(RunNotifier.class);
jUnitReporter.startExecutionUnit(executionUnitRunner, runNotifier);
jUnitReporter.startOfScenarioLifeCycle(mock(Scenario.class));
jUnitReporter.step(runnerStep);
jUnitReporter.match(mock(Match.class));
verify(runNotifier).fireTestStarted(executionUnitRunner.getDescription());
verify(runNotifier).fireTestStarted(runnerStepDescription);
}
use of gherkin.formatter.model.Step in project cucumber-jvm by cucumber.
the class ExecutionUnitRunner method getDescription.
@Override
public Description getDescription() {
if (description == null) {
description = Description.createSuiteDescription(getName(), cucumberScenario.getGherkinModel());
if (cucumberScenario.getCucumberBackground() != null) {
for (Step backgroundStep : cucumberScenario.getCucumberBackground().getSteps()) {
// We need to make a copy of that step, so we have a unique one per scenario
Step copy = new Step(backgroundStep.getComments(), backgroundStep.getKeyword(), backgroundStep.getName(), backgroundStep.getLine(), backgroundStep.getRows(), backgroundStep.getDocString());
description.addChild(describeChild(copy));
runnerSteps.add(copy);
}
}
for (Step step : getChildren()) {
description.addChild(describeChild(step));
runnerSteps.add(step);
}
}
return description;
}
Aggregations