use of org.jbehave.core.model.Story in project jbehave-core by jbehave.
the class RegexStoryParserBehaviour method shouldParseStoryAndProvideEmptyNameWhenPathIsNull.
@Test
public void shouldParseStoryAndProvideEmptyNameWhenPathIsNull() {
Story story = parser.parseStory(EMPTY, null);
assertThat(story.getPath(), equalTo(EMPTY));
assertThat(story.getName(), equalTo(EMPTY));
}
use of org.jbehave.core.model.Story in project jbehave-core by jbehave.
the class RegexStoryParserBehaviour method shouldParseStoryWithoutAPath.
@Test
public void shouldParseStoryWithoutAPath() {
String wholeStory = "Given a step" + NL + "When I run it" + NL + "Then I should an output";
Story story = parser.parseStory(wholeStory);
assertThat(story.getPath(), equalTo(EMPTY));
Scenario scenario = story.getScenarios().get(0);
assertThat(scenario.getSteps(), equalTo(asList("Given a step", "When I run it", "Then I should an output")));
}
use of org.jbehave.core.model.Story in project jbehave-core by jbehave.
the class RegexStoryParserBehaviour method shouldParseStoryWithIncompleteNarrative.
@Test
public void shouldParseStoryWithIncompleteNarrative() {
String wholeStory = "Story: This is free-text description" + NL + "Narrative: This is an incomplete narrative" + NL + "In order to renovate my house" + NL + "As a customer" + 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(), is(true));
}
use of org.jbehave.core.model.Story in project jbehave-core by jbehave.
the class RegexStoryParserBehaviour method parseStoryWithGivenStories.
private void parseStoryWithGivenStories(String wholeStory) {
Story story = parser.parseStory(wholeStory, storyPath);
Scenario scenario = story.getScenarios().get(0);
assertThat(scenario.getGivenStories().getPaths(), equalTo(asList("path/to/one", "path/to/two")));
assertThat(scenario.getSteps(), equalTo(asList("Given a step")));
}
use of org.jbehave.core.model.Story in project jbehave-core by jbehave.
the class RegexStoryParserBehaviour method shouldParseStoryWithGivenStoriesAndExamplesCommentedOut.
@Test
public void shouldParseStoryWithGivenStoriesAndExamplesCommentedOut() {
String wholeStory = "Scenario: Show that we can comment out GivenStories and Examples portions of a scenario" + NL + "!-- GivenStories: AGivenStoryToBeCommented" + NL + "Given a scenario Given" + NL + "When I parse it to When" + NL + "And I parse it to And" + NL + "!-- And ignore me too" + NL + "Then I should get steps Then" + NL + "!-- Examples:" + NL + "|Comment|Me|Out|" + NL + "|yes|we|can|" + NL;
Story story = parser.parseStory(wholeStory, storyPath);
Scenario scenario = story.getScenarios().get(0);
assertThat(scenario.getTitle(), equalTo("Show that we can comment out GivenStories and Examples portions of a scenario"));
assertThat(scenario.getGivenStories().getPaths(), equalTo(Arrays.<String>asList()));
List<String> steps = scenario.getSteps();
assertThat(steps.get(0), equalTo("!-- GivenStories: AGivenStoryToBeCommented"));
assertThat(steps.get(1), equalTo("Given a scenario Given"));
assertThat(steps.get(2), equalTo("When I parse it to When"));
assertThat(steps.get(3), equalTo("And I parse it to And"));
assertThat(steps.get(4), equalTo("!-- And ignore me too"));
assertThat(steps.get(5), equalTo("Then I should get steps Then"));
assertThat(steps.get(6), equalTo("!-- Examples:" + NL + "|Comment|Me|Out|" + NL + "|yes|we|can|"));
assertThat(scenario.getExamplesTable().asString(), equalTo(EMPTY));
}
Aggregations