use of cucumber.api.Scenario in project cucumber-jvm by cucumber.
the class RuntimeTest method should_make_scenario_id_available_to_hooks.
@Test
public void should_make_scenario_id_available_to_hooks() throws Throwable {
CucumberFeature feature = TestHelper.feature("path/test.feature", "Feature: feature name\n" + " Scenario: scenario name\n" + " Given first step\n" + " When second step\n" + " Then third step\n");
HookDefinition beforeHook = mock(HookDefinition.class);
when(beforeHook.matches(anyCollectionOf(Tag.class))).thenReturn(true);
Runtime runtime = createRuntimeWithMockedGlue(mock(StepDefinitionMatch.class), beforeHook, true);
feature.run(mock(Formatter.class), mock(Reporter.class), runtime);
ArgumentCaptor<Scenario> capturedScenario = ArgumentCaptor.forClass(Scenario.class);
verify(beforeHook).execute(capturedScenario.capture());
assertEquals("feature-name;scenario-name", capturedScenario.getValue().getId());
}
use of cucumber.api.Scenario in project cucumber-jvm by cucumber.
the class RuntimeTest method should_make_scenario_name_available_to_hooks.
@Test
public void should_make_scenario_name_available_to_hooks() throws Throwable {
CucumberFeature feature = TestHelper.feature("path/test.feature", "Feature: feature name\n" + " Scenario: scenario name\n" + " Given first step\n" + " When second step\n" + " Then third step\n");
HookDefinition beforeHook = mock(HookDefinition.class);
when(beforeHook.matches(anyCollectionOf(Tag.class))).thenReturn(true);
Runtime runtime = createRuntimeWithMockedGlue(mock(StepDefinitionMatch.class), beforeHook, true);
feature.run(mock(Formatter.class), mock(Reporter.class), runtime);
ArgumentCaptor<Scenario> capturedScenario = ArgumentCaptor.forClass(Scenario.class);
verify(beforeHook).execute(capturedScenario.capture());
assertEquals("scenario name", capturedScenario.getValue().getName());
}
Aggregations