Package org.jbehave.core.model

Examples of org.jbehave.core.model.Scenario


    public void shouldNotPassSilentlyOutputNotAllowedByMetaFilter() {
        // Given
        StoryReporter delegate = mock(StoryReporter.class);
        SilentSuccessFilter filter = new SilentSuccessFilter(delegate);
        Story story = new Story();
        Scenario scenario = new Scenario();

        String metaFilter = "";
        // When
        filter.storyNotAllowed(story, metaFilter);
        filter.scenarioNotAllowed(scenario, metaFilter);
View Full Code Here


        Properties meta = new Properties();
        meta.setProperty("theme", "testing");
        meta.setProperty("author", "Mauro");
        Story story = new Story("/path/to/story",
                new Description("An interesting story"), new Meta(meta), new Narrative("renovate my house", "customer", "get a loan"),
                Arrays.asList(new Scenario("A scenario", new Meta(meta), GivenStories.EMPTY, ExamplesTable.EMPTY, new ArrayList<String>())));
        reporter.beforeStory(story, false);
        if (storyNotAllowed) {
            reporter.storyNotAllowed(story, "-theme testing");
        } else  {
            reporter.beforeScenario(story.getScenarios().get(0).getTitle());
View Full Code Here

    @Test
    public void shouldMapStoriesAllowedByFilter() throws Throwable {
        // Given
        Meta meta1 = mock(Meta.class, "meta1");
        Story story1 = new Story("/path/to/story1", Description.EMPTY, meta1, Narrative.EMPTY, asList(new Scenario("scenario1", meta1)));
        Meta meta2 = mock(Meta.class, "meta2");
        Story story2 = new Story("/path/to/story2", Description.EMPTY, meta2, Narrative.EMPTY, asList(new Scenario("scenario2", meta2)));
        MetaFilter filter = mock(MetaFilter.class);
        String filterAsString = "-some property";
       
        // When
        StoryMapper mapper = new StoryMapper();
View Full Code Here

          + "| 4 | true |\n";
    Story story = storyParser.parseStory(storyAsText);
    assertThat(story.getDescription().asString(), equalTo("Hello Car"));   
    List<Scenario> scenarios = story.getScenarios();
    assertThat(scenarios.size(), equalTo(1));
    Scenario scenario = scenarios.get(0);
    List<String> steps = scenario.getSteps();
    assertThat(scenario.getTitle(), equalTo("Car can drive"));   
    assertThat(steps.size(), equalTo(2));
    assertThat(steps.get(0), equalTo("Given I have a car"));
    assertThat(steps.get(1), equalTo("Then I can drive them according to:\n"
        + "|wheels|can_drive|\n"
        + "|1|false|\n"
View Full Code Here

          + "| 4 | true |";
    Story story = storyParser.parseStory(storyAsText);   
    assertThat(story.getDescription().asString(), equalTo("Hello Car"));   
    List<Scenario> scenarios = story.getScenarios();
    assertThat(scenarios.size(), equalTo(1));
    Scenario scenario = scenarios.get(0);
    List<String> steps = scenario.getSteps();
    assertThat(scenario.getTitle(), equalTo("Car can drive"));   
    assertThat(scenario.getMeta().hasProperty("scenarioOutline"), is(true));
    assertThat(steps.size(), equalTo(3));
    assertThat(steps.get(0), equalTo("Given I have a car"));
    assertThat(steps.get(1), equalTo("When I add <wheels>"));
    assertThat(steps.get(2), equalTo("Then It <can_drive>"));
    assertThat(scenario.getExamplesTable().asString(), equalTo(
          "|wheels|can_drive|\n"
        + "|1|false|\n"
        + "|2|false|\n"
        + "|3|false|\n"
        + "|4|true|\n"));
View Full Code Here

                    + "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"));
        assertThat(story.getMeta().hasProperty("feature"), is(true));       
        Scenario scenario = story.getScenarios().get(0);
        assertThat(scenario.getSteps().size(), equalTo(2));
        assertThat(scenario.getMeta().hasProperty("scenario"), is(true));       
    }
View Full Code Here

        GivenStories givenStories = new GivenStories(StringUtils.join(givenStoryPaths, ","));
        ExamplesTable examplesTable = new ExamplesTable("|one|two|\n|1|2|\n");
        UUIDExceptionWrapper anException = new UUIDExceptionWrapper(new IllegalArgumentException());
        Story story = new Story();
        boolean givenStory = false;
        Scenario scenario = new Scenario();
        String filter = "-some property";
       
        // When
        delegator.dryRun();
       
View Full Code Here

    }

    @Test
    public void shouldRunStepsInStoryAndReportResultsToReporter() throws Throwable {
        // Given
        Scenario scenario1 = new Scenario("my title 1", asList("failingStep",
                "successfulStep"));
        Scenario scenario2 = new Scenario("my title 2", asList("successfulStep"));
        Scenario scenario3 = new Scenario("my title 3", asList("successfulStep",
                "pendingStep"));
        Story story = new Story(new Description("my blurb"), Narrative.EMPTY, asList(scenario1,
                scenario2, scenario3));
        StoryReporter reporter = mock(ConcurrentStoryReporter.class);
        StepCollector collector = mock(StepCollector.class);
View Full Code Here

    @Test
    public void shouldRunGivenStoriesAtStoryAndScenarioLevel() throws Throwable {
        // Given
        GivenStories storyGivenStories = new GivenStories("/path/to/given/story1");
        GivenStories scenarioGivenStories = new GivenStories("/path/to/given/story1");
        Scenario scenario1 = new Scenario("scenario 1", asList("successfulStep"));
        Scenario scenario2 = new Scenario("scenario 2", Meta.EMPTY, scenarioGivenStories, ExamplesTable.EMPTY,
                asList("anotherSuccessfulStep"));
        Story story1 = new Story(new Description("story 1"), Narrative.EMPTY, asList(scenario1));
        Story story2 = new Story("", new Description("story 2"), Meta.EMPTY, Narrative.EMPTY, storyGivenStories, asList(scenario2));

        Step step = mock(Step.class);
View Full Code Here

   
    @Test
  public void shouldIgnoreMetaFilteringInGivenStoriesIfConfigured()
      throws Throwable {
    // Given
    Scenario scenario = new Scenario("scenario", new Meta(
        asList("run false")), new GivenStories("/path/to/given/story"),
        ExamplesTable.EMPTY, asList("anotherSuccessfulStep"));
    Story story = new Story("", new Description("story"), new Meta(
        asList("run false")), Narrative.EMPTY, new GivenStories(
        "/path/to/given/story"), asList(scenario));
View Full Code Here

TOP

Related Classes of org.jbehave.core.model.Scenario

Copyright © 2018 www.massapicom. 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.