use of io.cucumber.core.gherkin.Pickle in project cucumber-jvm by cucumber.
the class RunnerTest method aftersteps_are_executed_after_failed_step.
@Test
void aftersteps_are_executed_after_failed_step() {
StubStepDefinition stepDefinition = spy(new StubStepDefinition("some step") {
@Override
public void execute(Object[] args) {
super.execute(args);
throw new RuntimeException();
}
});
Pickle pickleMatchingStepDefinitions = createPickleMatchingStepDefinitions(stepDefinition);
final HookDefinition afterStepHook = createHook();
TestRunnerSupplier runnerSupplier = new TestRunnerSupplier(bus, runtimeOptions) {
@Override
public void loadGlue(Glue glue, List<URI> gluePaths) {
glue.addAfterHook(afterStepHook);
glue.addStepDefinition(stepDefinition);
}
};
runnerSupplier.get().runPickle(pickleMatchingStepDefinitions);
InOrder inOrder = inOrder(afterStepHook, stepDefinition);
inOrder.verify(stepDefinition).execute(any(Object[].class));
inOrder.verify(afterStepHook).execute(any(TestCaseState.class));
}
use of io.cucumber.core.gherkin.Pickle in project cucumber-jvm by cucumber.
the class RunnerTest method steps_are_executed.
@Test
void steps_are_executed() {
StubStepDefinition stepDefinition = new StubStepDefinition("some step");
Pickle pickleMatchingStepDefinitions = createPickleMatchingStepDefinitions(stepDefinition);
TestRunnerSupplier runnerSupplier = new TestRunnerSupplier(bus, runtimeOptions) {
@Override
public void loadGlue(Glue glue, List<URI> gluePaths) {
glue.addStepDefinition(stepDefinition);
}
};
runnerSupplier.get().runPickle(pickleMatchingStepDefinitions);
assertThat(stepDefinition.getArgs(), is(equalTo(emptyList())));
}
use of io.cucumber.core.gherkin.Pickle in project cucumber-jvm by cucumber.
the class RunnerTest method aftersteps_executed_for_passed_step.
@Test
void aftersteps_executed_for_passed_step() {
StubStepDefinition stepDefinition = spy(new StubStepDefinition("some step"));
Pickle pickle = createPickleMatchingStepDefinitions(stepDefinition);
HookDefinition afteStepHook1 = createHook();
HookDefinition afteStepHook2 = createHook();
TestRunnerSupplier runnerSupplier = new TestRunnerSupplier(bus, runtimeOptions) {
@Override
public void loadGlue(Glue glue, List<URI> gluePaths) {
glue.addAfterHook(afteStepHook1);
glue.addAfterHook(afteStepHook2);
glue.addStepDefinition(stepDefinition);
}
};
runnerSupplier.get().runPickle(pickle);
InOrder inOrder = inOrder(afteStepHook1, afteStepHook2, stepDefinition);
inOrder.verify(stepDefinition).execute(any(Object[].class));
inOrder.verify(afteStepHook2).execute(any(TestCaseState.class));
inOrder.verify(afteStepHook1).execute(any(TestCaseState.class));
}
use of io.cucumber.core.gherkin.Pickle in project cucumber-jvm by cucumber.
the class RunnerTest method steps_are_not_executed_on_dry_run.
@Test
void steps_are_not_executed_on_dry_run() {
StubStepDefinition stepDefinition = new StubStepDefinition("some step");
Pickle pickle = createPickleMatchingStepDefinitions(stepDefinition);
RuntimeOptions runtimeOptions = new RuntimeOptionsBuilder().setDryRun().build();
TestRunnerSupplier runnerSupplier = new TestRunnerSupplier(bus, runtimeOptions) {
@Override
public void loadGlue(Glue glue, List<URI> gluePaths) {
glue.addStepDefinition(stepDefinition);
}
};
runnerSupplier.get().runPickle(pickle);
assertThat(stepDefinition.getArgs(), is(nullValue()));
}
use of io.cucumber.core.gherkin.Pickle in project cucumber-jvm by cucumber.
the class PickleRunnerWithStepDescriptionsTest method shouldUseScenarioNameForDisplayName.
@Test
void shouldUseScenarioNameForDisplayName() {
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("scenario name", runner.getDescription().getDisplayName());
}
Aggregations