Examples of StoryDetails


Examples of org.jbehave.core.story.codegen.domain.StoryDetails

public class StoryBuilderBehaviour extends UsingMatchers {

    public void shouldBuildStoryFromStoryDetails() throws Exception {
        // given
        StoryDetails storyDetails = new StoryDetails("Joe drinks vodka", "", "", "");
        ScenarioDetails expectedScenario1 = new ScenarioDetails();
        expectedScenario1.name = "Happy path";
        expectedScenario1.context.givens.add("Joe is thirsty");
        expectedScenario1.event.name = "Joe asks for a Smirnov";
        expectedScenario1.outcome.outcomes.add("bartender serves Joe");
        expectedScenario1.outcome.outcomes.add("Joe is happy");
        storyDetails.addScenario(expectedScenario1);
        ScenarioDetails expectedScenario2 = new ScenarioDetails();
        expectedScenario2.name = "Unhappy path";
        expectedScenario2.context.givens.add("Joe is thirsty");
        expectedScenario2.event.name = "Joe asks for an Absolut";
        expectedScenario2.outcome.outcomes.add("bartender denies Joe");
        expectedScenario2.outcome.outcomes.add("Joe is unhappy");
        storyDetails.addScenario(expectedScenario2);

        // when
        Story story = new StoryBuilder(storyDetails, "jbehave.core.story.stories").story();
       
        // then
View Full Code Here

Examples of org.jbehave.core.story.codegen.domain.StoryDetails

            ve.init();
            new File("build/generated").delete();
            new File("build/generated/example/stories").mkdirs();
            // read template
            StoryDetails story = buildStory();
            VelocityContext context = new VelocityContext();
            context.put("basePackage", "example.stories");
            generateStory(context, story, ve);
            generateOtherStuff(context, story, ve);
        } catch (Exception e) {
View Full Code Here

Examples of org.jbehave.core.story.codegen.domain.StoryDetails

//                "When some other thing happens.\n" +
//                "Then do something good.\n" +
//                "endStory");

        new FileReader("analysis/user withdraws cash.txt");
        StoryDetails details = null;
        return details;
    }
View Full Code Here

Examples of org.jbehave.core.story.codegen.domain.StoryDetails

        this.classLoader = classLoader;
        this.storyParser = storyParser;
    }

    public Story loadStory(String storyPath, String storyPackage) throws MalformedURLException {
        StoryDetails storyDetails = storyParser.parseStory(getReader(storyPath, classLoader));
        return new StoryBuilder(storyDetails, storyPackage).story();
    }
View Full Code Here

Examples of org.jbehave.core.story.codegen.domain.StoryDetails

public class TextStoryParserBehaviour extends UsingMatchers {

  public void shouldBuildStoryDetailsWithTitle() throws Exception {
    // given
    String text = "Title: Joe drinks vodka\n";
    StoryDetails expectedStory = new StoryDetails("Joe drinks vodka", "", "", "");
    // when
    StoryDetails result = new TextStoryParser().parseStory(new StringReader(text));
    // then
    ensureThat(result, eq(expectedStory));
  }
View Full Code Here

Examples of org.jbehave.core.story.codegen.domain.StoryDetails

  public void shouldBuildStoryDetailsWithTitleAndRole() throws Exception {
    // given
    String text =
      "Title: Joe drinks vodka\n"
      + "As a drinker\n";
    StoryDetails expectedStory = new StoryDetails(
        "Joe drinks vodka",
        "drinker", "", "");
    // when
    StoryDetails result = new TextStoryParser().parseStory(new StringReader(text));
    // then
    ensureThat(result, eq(expectedStory));
  }
View Full Code Here

Examples of org.jbehave.core.story.codegen.domain.StoryDetails

    // given
    String text =
      "Title: Joe drinks vodka\n"
      + "As a drinker\n"
      + "I want a glass of vodka\n";
    StoryDetails expectedStory = new StoryDetails(
        "Joe drinks vodka",
        "drinker", "a glass of vodka", "");
    // when
    StoryDetails result = new TextStoryParser().parseStory(new StringReader(text));
    // then
    ensureThat(result, eq(expectedStory));
  }
View Full Code Here

Examples of org.jbehave.core.story.codegen.domain.StoryDetails

    String text =
      "Title: Joe drinks vodka\n"
      + "As a drinker\n"
      + "I want a glass of vodka\n"
      + "So that I feel tipsy\n";
    StoryDetails expectedStory = new StoryDetails(
        "Joe drinks vodka",
        "drinker", "a glass of vodka", "I feel tipsy");
    // when
    StoryDetails result = new TextStoryParser().parseStory(new StringReader(text));
    // then
    ensureThat(result, eq(expectedStory));
  }
View Full Code Here

Examples of org.jbehave.core.story.codegen.domain.StoryDetails

    String text =
      "Title: Joe drinks vodka\n"
      + "Scenario: Happy path\n";
    ScenarioDetails expectedScenario = new ScenarioDetails();
    expectedScenario.name = "Happy path";
    StoryDetails expectedStory = new StoryDetails("Joe drinks vodka", "", "", "");
    expectedStory.addScenario(expectedScenario);

    // when
    StoryDetails result = new TextStoryParser().parseStory(new StringReader(text));
   
    // then
    ensureThat(result, eq(expectedStory));
  }
View Full Code Here

Examples of org.jbehave.core.story.codegen.domain.StoryDetails

            + "Given a pub uptown\n"
            + "Given an equally thirsty Joe\n"
            + "When Joe asks for an Absolut\n"
            + "Then bartender tells Joe it is sold out\n"
            + "Then Joe is unhappy\n";
        StoryDetails expectedStory = new StoryDetails("Joe drinks vodka", "", "", "");
        ScenarioDetails expectedScenario1 = new ScenarioDetails();
        expectedScenario1.name = "Happy path";
        expectedScenario1.context.givens.add("a bar downtown");
        expectedScenario1.context.givens.add("a thirsty Joe");
        expectedScenario1.event.name = "Joe asks for a Smirnov";
        expectedScenario1.outcome.outcomes.add("bartender serves Joe");
        expectedScenario1.outcome.outcomes.add("Joe is happy");
        expectedStory.addScenario(expectedScenario1);
        ScenarioDetails expectedScenario2 = new ScenarioDetails();
        expectedScenario2.name = "Unhappy path";
        expectedScenario2.context.givens.add("a pub uptown");
        expectedScenario2.context.givens.add("an equally thirsty Joe");
        expectedScenario2.event.name = "Joe asks for an Absolut";
        expectedScenario2.outcome.outcomes.add("bartender tells Joe it is sold out");
        expectedScenario2.outcome.outcomes.add("Joe is unhappy");
        expectedStory.addScenario(expectedScenario2);

        // when
        StoryDetails result = new TextStoryParser().parseStory(new StringReader(text));
       
        // then
        ensureThat(result, eq(expectedStory));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.