Package org.jbehave.core.model

Examples of org.jbehave.core.model.Story


        protected void processStories(List<StoryHolder> stories, Set<String> stepsPerformed, Map<String, Long> times,
                StoryReporterBuilder builder, Set<String> failures, Set<String> pendingStories) {
            // Prevent Concurrent Modification Exception.
            synchronized (stories) {
                for (StoryHolder storyHolder : stories) {
                    Story story = storyHolder.story;
                    String path = story.getPath();
                    if (!path.equals("BeforeStories") && !path.equals("AfterStories")) {
                        if (someScenarios(story, stepsPerformed) || !excludeStoriesWithNoExecutedScenarios) {
                            XRefStory xRefStory = createXRefStory(builder, story, !failures.contains(path), pendingStories.contains(path), this);
                            xRefStory.started = storyHolder.when;
                            xRefStory.duration = getTime(times, story);
View Full Code Here


        while (!allDone || !started) {
            allDone = true;
            for (RunningStory runningStory : runningStories.values()) {             
                if ( runningStory.isStarted() ){
                  started = true;
                    Story story = runningStory.getStory();
          Future<ThrowableStory> future = runningStory.getFuture();
          if (!future.isDone()) {
            allDone = false;
            StoryDuration duration = runningStory.getDuration();
            runningStory.updateDuration();
            if (duration.timedOut()) {
              embedderMonitor.storyTimeout(story, duration);
              storyRunner.cancelStory(story, duration);
              future.cancel(true);
              if (embedderControls.failOnStoryTimeout()) {
                throw new StoryExecutionFailed(story.getPath(),
                    new StoryTimeout(duration));
              }
              continue;
            }
          } else {
            try {
              ThrowableStory throwableStory = future.get();
              Throwable throwable = throwableStory.getThrowable();
              if (throwable != null) {
                failures.put(story.getPath(), throwable);
                if (!embedderControls.ignoreFailureInStories()) {
                  continue;
                }
              }
            } catch (Throwable e) {
              failures.put(story.getPath(), e);
              if (!embedderControls.ignoreFailureInStories()) {
                continue;
              }
            }
          }
View Full Code Here

        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;
    }
View Full Code Here

     * @return The State after running the steps
     */
    public State runBeforeOrAfterStories(Configuration configuration, List<CandidateSteps> candidateSteps, Stage stage) {
        String storyPath = capitalizeFirstLetter(stage.name().toLowerCase()) + "Stories";
        reporter.set(configuration.storyReporter(storyPath));
        reporter.get().beforeStory(new Story(storyPath), false);
        RunContext context = new RunContext(configuration, candidateSteps, storyPath, MetaFilter.EMPTY);
        if (stage == Stage.BEFORE) {
            resetStoryFailure(context);
        }
        if (stage == Stage.AFTER && storiesState.get() != null) {
View Full Code Here

        if (givenStories.getPaths().size() > 0) {
            reporter.get().givenStories(givenStories);
            for (GivenStory givenStory : givenStories.getStories()) {
                RunContext childContext = context.childContextFor(givenStory);
                // run given story, using any parameters provided
                Story story = storyOfPath(context.configuration(), childContext.path());
                if ( givenStory.hasAnchorParameters() ){
                    story = storyWithMatchingScenarios(story, givenStory.getAnchorParameters());
                }
                parameters.putAll(givenStory.getParameters());
                run(childContext, story, parameters);
View Full Code Here

        for ( Scenario scenario : story.getScenarios() ){
            if ( matchesParameters(scenario, parameters) ){
                scenarios.add(scenario);
            }
        }
        return new Story(story.getPath(), story.getDescription(), story.getMeta(), story.getNarrative(), scenarios);
    }
View Full Code Here

        processSystemProperties();

        StoryManager storyManager = storyManager();
        for (String storyPath : storyPaths) {
            Story story = storyManager.storyOfPath(storyPath);
            embedderMonitor.mappingStory(storyPath, metaFilters());
            storyMapper.map(story, new MetaFilter(""));
            for (String filter : metaFilters) {
                storyMapper.map(story, new MetaFilter(filter));
            }
View Full Code Here

    public Story parseStory(String storyAsText, String storyPath) {
        Description description = parseDescriptionFrom(storyAsText);
        Narrative narrative = parseNarrativeFrom(storyAsText);
        List<Scenario> scenarios = parseScenariosFrom(storyAsText);
        Story story = new Story(storyPath, description, narrative, scenarios);
        if ( storyPath != null ){
            story.namedAs(new File(storyPath).getName());
        }
        return story;
    }
View Full Code Here

        BatchFailures batchFailures = new BatchFailures();
        buildReporters(configuration, storyPaths);
        for (String storyPath : storyPaths) {
            try {
                embedderMonitor.runningStory(storyPath);
                Story story = storyRunner.storyOfPath(configuration, storyPath);
                storyRunner.run(configuration, candidateSteps, story);
            } catch (Throwable e) {
                if (embedderControls.batch()) {
                    // collect and postpone decision to throw exception
                    batchFailures.put(storyPath, e);
View Full Code Here

        List<String> storyPaths = scenario.getGivenStoryPaths();
        if (storyPaths.size() > 0) {
            reporter.givenStories(storyPaths);
            for (String storyPath : storyPaths) {
                // run given story
                Story story = storyOfPath(configuration, storyPath);
                run(configuration, candidateSteps, story, true);
            }
        }
    }
View Full Code Here

TOP

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

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.