use of org.jbehave.core.model.Meta in project jbehave-core by jbehave.
the class PerformableTree method performableStory.
private PerformableStory performableStory(RunContext context, Story story, Map<String, String> storyParameters) {
PerformableStory performableStory = new PerformableStory(story, context.configuration().keywords(), context.givenStory());
// determine if story is allowed
boolean storyAllowed = true;
FilteredStory filteredStory = context.filter(story);
Meta storyMeta = story.getMeta();
if (!filteredStory.allowed()) {
storyAllowed = false;
}
performableStory.allowed(storyAllowed);
if (storyAllowed) {
performableStory.addBeforeSteps(context.beforeOrAfterStorySteps(story, Stage.BEFORE));
performableStory.addBeforeSteps(context.lifecycleSteps(story.getLifecycle(), storyMeta, Stage.BEFORE, Scope.STORY));
// determine if before and after scenario steps should be run
boolean runBeforeAndAfterScenarioSteps = shouldRunBeforeOrAfterScenarioSteps(context);
for (Scenario scenario : story.getScenarios()) {
Map<String, String> scenarioParameters = new HashMap<>(storyParameters);
PerformableScenario performableScenario = performableScenario(context, story, scenarioParameters, filteredStory, storyMeta, runBeforeAndAfterScenarioSteps, scenario);
if (performableScenario.hasNormalScenario() || performableScenario.hasExamples()) {
performableStory.add(performableScenario);
}
}
// Add Given stories only if story contains scenarios
if (!performableStory.getScenarios().isEmpty()) {
Map<String, String> givenStoryParameters = new HashMap<>(storyParameters);
addMetaParameters(givenStoryParameters, storyMeta);
if (story.hasGivenStories()) {
performableStory.addGivenStories(performableGivenStories(context, story.getGivenStories(), givenStoryParameters));
}
}
performableStory.addAfterSteps(context.lifecycleSteps(story.getLifecycle(), storyMeta, Stage.AFTER, Scope.STORY));
performableStory.addAfterSteps(context.beforeOrAfterStorySteps(story, Stage.AFTER));
}
return performableStory;
}
use of org.jbehave.core.model.Meta in project jbehave-core by jbehave.
the class PerformableTree method parameterMeta.
private Meta parameterMeta(RunContext context, Map<String, String> parameters) {
Meta meta = Meta.EMPTY;
Keywords keywords = context.configuration().keywords();
String metaText = keywords.meta();
if (parameters.containsKey(metaText)) {
meta = Meta.createMeta(parameters.get(metaText), keywords);
}
return meta;
}
Aggregations