use of org.jbehave.core.model.GivenStories in project jbehave-core by jbehave.
the class RegexStoryParser method parseGivenStories.
private GivenStories parseGivenStories(String storyAsText) {
String scenarioKeyword = keywords.scenario();
// use text before scenario keyword, if found
String beforeScenario = "";
if (StringUtils.contains(storyAsText, scenarioKeyword)) {
beforeScenario = StringUtils.substringBefore(storyAsText, scenarioKeyword);
}
Matcher findingGivenStories = findingStoryGivenStories().matcher(beforeScenario);
String givenStories = findingGivenStories.find() ? findingGivenStories.group(1).trim() : NONE;
return new GivenStories(givenStories);
}
use of org.jbehave.core.model.GivenStories in project jbehave-core by jbehave.
the class RegexStoryParser method parseScenario.
private Scenario parseScenario(String scenarioAsText) {
String title = findScenarioTitle(scenarioAsText);
String scenarioWithoutKeyword = removeStart(scenarioAsText, keywords.scenario()).trim();
String scenarioWithoutTitle = removeStart(scenarioWithoutKeyword, title);
scenarioWithoutTitle = startingWithNL(scenarioWithoutTitle);
Meta meta = findScenarioMeta(scenarioWithoutTitle);
ExamplesTable examplesTable = findExamplesTable(scenarioWithoutTitle);
GivenStories givenStories = findScenarioGivenStories(scenarioWithoutTitle);
if (givenStories.requireParameters()) {
givenStories.useExamplesTable(examplesTable);
}
List<String> steps = findSteps(scenarioWithoutTitle);
return new Scenario(title, meta, givenStories, examplesTable, steps);
}
use of org.jbehave.core.model.GivenStories in project jbehave-core by jbehave.
the class RegexStoryParser method parseStory.
public Story parseStory(String storyAsText, String storyPath) {
Description description = parseDescriptionFrom(storyAsText);
Meta meta = parseStoryMetaFrom(storyAsText);
Narrative narrative = parseNarrativeFrom(storyAsText);
GivenStories givenStories = parseGivenStories(storyAsText);
Lifecycle lifecycle = parseLifecycle(storyAsText);
List<Scenario> scenarios = parseScenariosFrom(storyAsText);
Story story = new Story(storyPath, description, meta, narrative, givenStories, lifecycle, scenarios);
if (storyPath != null) {
story.namedAs(new File(storyPath).getName());
}
return story;
}
Aggregations