use of org.jbehave.core.model.Narrative in project jbehave-core by jbehave.
the class RegexStoryParserBehaviour method shouldParseStoryWithAlternativeNarrative.
@Test
public void shouldParseStoryWithAlternativeNarrative() {
String wholeStory = "Story: This is free-text description" + NL + "Narrative: This is an alternative narrative" + NL + "As a customer" + NL + "I want to get a loan" + NL + "So that I can renovate my house" + NL + "Scenario: A first scenario";
Story story = parser.parseStory(wholeStory, storyPath);
Description description = story.getDescription();
assertThat(description.asString(), equalTo("Story: This is free-text description"));
Narrative narrative = story.getNarrative();
assertThat(narrative.isEmpty(), not(true));
assertThat(narrative.asA().toString(), equalTo("customer"));
assertThat(narrative.iWantTo().toString(), equalTo("get a loan"));
assertThat(narrative.soThat().toString(), equalTo("I can renovate my house"));
}
use of org.jbehave.core.model.Narrative in project jbehave-core by jbehave.
the class RegexStoryParserBehaviour method shouldParseStoryWithDescriptionAndNarrative.
@Test
public void shouldParseStoryWithDescriptionAndNarrative() {
String wholeStory = "Story: This is free-text description" + NL + "Narrative: This bit of text is ignored" + NL + "In order to renovate my house" + NL + "As a customer" + NL + "I want to get a loan" + NL + "Scenario: A first scenario";
Story story = parser.parseStory(wholeStory, storyPath);
Description description = story.getDescription();
assertThat(description.asString(), equalTo("Story: This is free-text description"));
Narrative narrative = story.getNarrative();
assertThat(narrative.isEmpty(), not(true));
assertThat(narrative.inOrderTo().toString(), equalTo("renovate my house"));
assertThat(narrative.asA().toString(), equalTo("customer"));
assertThat(narrative.iWantTo().toString(), equalTo("get a loan"));
}
use of org.jbehave.core.model.Narrative 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;
}
use of org.jbehave.core.model.Narrative in project jbehave-core by jbehave.
the class GherkinStoryParserBehaviour method shouldParseStoryWithAlternativeNarrative.
@Test
public void shouldParseStoryWithAlternativeNarrative() throws IOException {
String storyAsText = "Feature: Hello Car\n" + "Narrative:\n" + "As a car driver\n" + "I want to drive cars on 4 wheels\n" + "So that I can feel safer\n" + "Scenario: Car can drive\n" + "Given I have a car with 4 wheels\n" + "Then I can drive it.\n";
Story story = storyParser.parseStory(storyAsText);
assertThat(story.getDescription().asString(), equalTo("Hello Car"));
Narrative narrative = story.getNarrative();
assertThat(narrative.asA(), equalTo("car driver"));
assertThat(narrative.iWantTo(), equalTo("drive cars on 4 wheels"));
assertThat(narrative.soThat(), equalTo("I can feel safer"));
}
Aggregations