Package org.jbehave.core.failures

Examples of org.jbehave.core.failures.BatchFailures


            storyPaths.add(storyPath);
            Story story = mockStory(Meta.EMPTY);
            stories.put(storyPath, story);
            when(runner.storyOfPath(configuration, storyPath)).thenReturn(story);
        }
        BatchFailures failures = new BatchFailures();
        for (String storyPath : storyPaths) {
            RuntimeException thrown = new RuntimeException(storyPath + " failed");
            failures.put(storyPath, thrown);
            doThrow(thrown).when(runner).run(Matchers.eq(configuration), Matchers.eq(stepsFactory),
                    Matchers.eq(stories.get(storyPath)), Matchers.any(MetaFilter.class), Matchers.any(State.class));
        }

        // When
View Full Code Here


        monitor.runningEmbeddable("embeddable");
        monitor.runningStory("/path");
        monitor.generatingReportsView(new File("target"), Arrays.asList(Format.HTML.name()), new Properties());
        monitor.reportsViewGenerated(new ReportsCount(1, 0, 1, 2, 1, 0, 1, 1));
        assertThat(out.toString(), is(""));
        monitor.batchFailed(new BatchFailures());
        monitor.storyFailed("/path", new RuntimeException());
        assertThat(out.toString(), is(not("")));
   }
View Full Code Here

        EmbedderMonitor monitor = new EmbedderMonitorDecorator(delegate);
       
        // When
        Object annotatedInstance = new Object();
        monitor.annotatedInstanceNotOfType(annotatedInstance, annotatedInstance.getClass());
        BatchFailures failures = new BatchFailures();
        monitor.batchFailed(failures);
        monitor.beforeOrAfterStoriesFailed();
        String name = "name";
        Throwable cause = new Throwable();
        monitor.embeddableFailed(name, cause);
View Full Code Here

        // Then
        EmbedderMonitor embedderMonitor = embedder.embedderMonitor();
        assertThat(embedderMonitor.toString(), containsString("MavenEmbedderMonitor"));

        // and verify monitor calls are propagated to Mojo Log
        BatchFailures failures = new BatchFailures();
        embedderMonitor.batchFailed(failures);
        verify(log).warn("Failed to run batch " + failures);

        String name = "name";
        Throwable cause = new RuntimeException();
View Full Code Here

        if (embedderControls.skip()) {
            embedderMonitor.embeddablesSkipped(classNames);
            return;
        }

        BatchFailures failures = new BatchFailures(embedderControls.verboseFailures());
        for (Embeddable embeddable : embeddables(classNames, classLoader())) {
            String name = embeddable.getClass().getName();
            try {
                embedderMonitor.runningEmbeddable(name);
                embeddable.useEmbedder(this);
                embeddable.run();
            } catch (Throwable e) {
                if (embedderControls.batch()) {
                    // collect and postpone decision to throw exception
                    failures.put(name, e);
                } else {
                    if (ignoreFailure(embedderControls)) {
                        embedderMonitor.embeddableFailed(name, e);
                    } else {
                        throw new RunningEmbeddablesFailed(name, e);
                    }
                }
            }
        }

        if (embedderControls.batch() && failures.size() > 0) {
            if (ignoreFailure(embedderControls)) {
                embedderMonitor.batchFailed(failures);
            } else {
                throw new RunningEmbeddablesFailed(failures);
            }
View Full Code Here

        try {

            // set up run context
            StoryManager storyManager = createStoryManager();
            MetaFilter filter = metaFilter();
            BatchFailures failures = new BatchFailures(embedderControls.verboseFailures());

            // run stories
            storyManager.runStories(storyPaths, filter, failures);

            // handle any failures
View Full Code Here

        // Then
        EmbedderMonitor embedderMonitor = embedder.embedderMonitor();
        assertThat(embedderMonitor.toString(), equalTo("AntEmbedderMonitor"));

        // and verify monitor calls are propagated to Project log
        BatchFailures failures = new BatchFailures();
        embedderMonitor.batchFailed(failures);
        verify(project).log(task, "Failed to run batch " + failures, MSG_WARN);

        String name = "name";
        Throwable cause = new RuntimeException();
View Full Code Here

        if (embedderControls.skip()) {
            embedderMonitor.embeddablesSkipped(classNames);
            return;
        }

        BatchFailures batchFailures = new BatchFailures();
        for (Embeddable embeddable : embeddables(classNames, classLoader)) {
            String name = embeddable.getClass().getName();
            try {
                embedderMonitor.runningEmbeddable(name);
                embeddable.useEmbedder(this);
                embeddable.run();
            } catch (Throwable e) {
                if (embedderControls.batch()) {
                    // collect and postpone decision to throw exception
                    batchFailures.put(name, e);
                } else {
                    if (embedderControls.ignoreFailureInStories()) {
                        embedderMonitor.embeddableFailed(name, e);
                    } else {
                        throw new RunningStoriesFailed(name, e);
                    }
                }
            }
        }

        if (embedderControls.batch() && batchFailures.size() > 0) {
            if (embedderControls.ignoreFailureInStories()) {
                embedderMonitor.batchFailed(batchFailures);
            } else {
                throw new RunningStoriesFailed(batchFailures);
            }
View Full Code Here

        Configuration configuration = configuration();
        List<CandidateSteps> candidateSteps = candidateSteps();
       
        storyRunner.runBeforeOrAfterStories(configuration, candidateSteps, Stage.BEFORE);
       
        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);
                } else {
                    if (embedderControls.ignoreFailureInStories()) {
                        embedderMonitor.storyFailed(storyPath, e);
                    } else {
                        throw new RunningStoriesFailed(storyPath, e);
                    }
                }
            }
        }

        storyRunner.runBeforeOrAfterStories(configuration, candidateSteps, Stage.AFTER);
       
        if (embedderControls.batch() && batchFailures.size() > 0) {
            if (embedderControls.ignoreFailureInStories()) {
                embedderMonitor.batchFailed(batchFailures);
            } else {
                throw new RunningStoriesFailed(batchFailures);
            }
View Full Code Here

TOP

Related Classes of org.jbehave.core.failures.BatchFailures

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.