use of org.jbehave.core.annotations.ScenarioType in project jbehave-core by jbehave.
the class StepsBehaviour method shouldProvideStepsToBePerformedBeforeAndAfterScenariosParametrisedByExample.
@Test
public void shouldProvideStepsToBePerformedBeforeAndAfterScenariosParametrisedByExample() {
MultipleAliasesSteps steps = new MultipleAliasesSteps();
ScenarioType scenarioType = ScenarioType.EXAMPLE;
List<BeforeOrAfterStep> beforeAfterScenario = steps.listBeforeOrAfterScenario(scenarioType);
assertThat(beforeAfterScenario.size(), equalTo(2));
beforeAfterScenario.get(0).createStep().perform(null);
assertThat(steps.beforeExampleScenario, is(true));
beforeAfterScenario.get(1).createStep().perform(null);
assertThat(steps.afterExampleScenario, is(true));
}
use of org.jbehave.core.annotations.ScenarioType in project jbehave-core by jbehave.
the class StepsBehaviour method shouldProvideStepsToBeNotPerformedAfterScenarioUponOutcome.
@Test
public void shouldProvideStepsToBeNotPerformedAfterScenarioUponOutcome() {
MultipleAliasesSteps steps = new MultipleAliasesSteps();
ScenarioType scenarioType = ScenarioType.NORMAL;
List<BeforeOrAfterStep> beforeAfterScenario = steps.listBeforeOrAfterScenario(scenarioType);
assertThat(beforeAfterScenario.size(), equalTo(4));
beforeAfterScenario.get(0).createStep().doNotPerform(null);
assertThat(steps.beforeNormalScenario, is(true));
Meta storyAndScenarioMeta = null;
UUIDExceptionWrapper failure = new UUIDExceptionWrapper();
// uponOutcome=ANY
beforeAfterScenario.get(1).createStepUponOutcome(storyAndScenarioMeta).doNotPerform(failure);
assertThat(steps.afterNormalScenario, is(true));
// uponOutcome=SUCCESS
beforeAfterScenario.get(2).createStepUponOutcome(storyAndScenarioMeta).doNotPerform(failure);
assertThat(steps.afterSuccessfulScenario, is(false));
// uponOutcome=FAILURE
beforeAfterScenario.get(3).createStepUponOutcome(storyAndScenarioMeta).doNotPerform(failure);
assertThat(steps.afterFailedScenario, is(true));
}
use of org.jbehave.core.annotations.ScenarioType in project jbehave-core by jbehave.
the class StepsBehaviour method shouldProvideStepsToBePerformedBeforeAndAfterScenariosWithFailureOccuring.
@Test
public void shouldProvideStepsToBePerformedBeforeAndAfterScenariosWithFailureOccuring() {
MultipleAliasesSteps steps = new MultipleAliasesSteps();
ScenarioType scenarioType = ScenarioType.NORMAL;
List<BeforeOrAfterStep> beforeAfterScenario = steps.listBeforeOrAfterScenario(scenarioType);
assertThat(beforeAfterScenario.size(), equalTo(4));
beforeAfterScenario.get(0).createStep().perform(null);
assertThat(steps.beforeNormalScenario, is(true));
Meta storyAndScenarioMeta = null;
// uponOutcome=ANY
beforeAfterScenario.get(1).createStepUponOutcome(storyAndScenarioMeta).perform(null);
assertThat(steps.afterNormalScenario, is(true));
// uponOutcome=SUCCESS
beforeAfterScenario.get(2).createStepUponOutcome(storyAndScenarioMeta).doNotPerform(null);
assertThat(steps.afterSuccessfulScenario, is(false));
// uponOutcome=FAILURE
beforeAfterScenario.get(3).createStepUponOutcome(storyAndScenarioMeta).doNotPerform(null);
assertThat(steps.afterFailedScenario, is(true));
}
use of org.jbehave.core.annotations.ScenarioType in project jbehave-core by jbehave.
the class StepsBehaviour method shouldProvideStepsToBePerformedBeforeAndAfterAnyScenario.
@Test
public void shouldProvideStepsToBePerformedBeforeAndAfterAnyScenario() {
MultipleAliasesSteps steps = new MultipleAliasesSteps();
ScenarioType scenarioType = ScenarioType.ANY;
List<BeforeOrAfterStep> beforeAfterScenario = steps.listBeforeOrAfterScenario(scenarioType);
assertThat(beforeAfterScenario.size(), equalTo(2));
beforeAfterScenario.get(0).createStep().perform(null);
assertThat(steps.beforeAnyScenario, is(true));
beforeAfterScenario.get(1).createStep().perform(null);
assertThat(steps.afterAnyScenario, is(true));
}
use of org.jbehave.core.annotations.ScenarioType in project jbehave-core by jbehave.
the class StepsBehaviour method shouldProvideStepsToBePerformedBeforeAndAfterScenariosWithNoFailureOccuring.
@Test
public void shouldProvideStepsToBePerformedBeforeAndAfterScenariosWithNoFailureOccuring() {
MultipleAliasesSteps steps = new MultipleAliasesSteps();
ScenarioType scenarioType = ScenarioType.NORMAL;
List<BeforeOrAfterStep> beforeAfterScenario = steps.listBeforeOrAfterScenario(scenarioType);
assertThat(beforeAfterScenario.size(), equalTo(4));
beforeAfterScenario.get(0).createStep().perform(null);
assertThat(steps.beforeNormalScenario, is(true));
Meta storyAndScenarioMeta = null;
// uponOutcome=ANY
beforeAfterScenario.get(1).createStepUponOutcome(storyAndScenarioMeta).perform(null);
assertThat(steps.afterNormalScenario, is(true));
// uponOutcome=SUCCESS
beforeAfterScenario.get(2).createStepUponOutcome(storyAndScenarioMeta).perform(null);
assertThat(steps.afterSuccessfulScenario, is(true));
// uponOutcome=FAILURE
beforeAfterScenario.get(3).createStepUponOutcome(storyAndScenarioMeta).perform(null);
assertThat(steps.afterFailedScenario, is(false));
}
Aggregations