Hi Luis, by default, JBehave is configured not to fail on pending steps. You can configure a different pending step strategy to fail on pending:

http://jbehave.org/reference/stable/pending-steps.html

Cheers

On Tue Sep 13 08:50:34 2011, luis wrote:
Hi all,

I'm trying to configure JBehave to fail when it finds pending steps
but I would like to have the failures occur as late as possible, after
the generation of the view.

I've been messing around with the configuration for a while now but
clearly there's something I'm still missing here... So, here's my
JBehave Runner class:


@RunWith(AnnotatedEmbedderRunner.class)
@Configure(
         storyControls = JBehaveTest.MyStoryControls.class,
         storyReporterBuilder = JBehaveTest.MyReportBuilder.class)

@UsingEmbedder(
         batch = true,
         embedder = Embedder.class,
         generateViewAfterStories = true,
         ignoreFailureInStories = true,
         ignoreFailureInView = false)

@UsingSteps(instances = {
         JBehaveCreatingAPlaceSteps.class,
         JBehaveDetailsForAPlaceSteps.class,
         JBehaveEnhancePlaceSteps.class,
         JBehaveUserSessionSteps.class,
         JBehaveMapSteps.class,
         JBehaveSearchSteps.class
})
public class JBehaveTest extends InjectableEmbedder {

     @Test
     public void run() {

         List<String>  storyPaths = new
StoryFinder().findPaths(CodeLocations.codeLocationFromClass(this.getClass()),
"**/*.story", "");
         injectedEmbedder().configuration().usePendingStepStrategy(new
FailingUponPendingStep());
         injectedEmbedder().embedderControls().useThreads(6);

         injectedEmbedder().runStoriesAsPaths(storyPaths);
     }

     private static class MyReportBuilder extends StoryReporterBuilder {

         public MyReportBuilder() {

             Properties viewResources = new Properties();
             viewResources.put("decorateNonHtml", "true");

             
this.withCodeLocation(CodeLocations.codeLocationFromClass(this.getClass()))
                     .withPathResolver(new
FilePrintStreamFactory.ResolveToPackagedName())
                     .withViewResources(viewResources)
                     .withFailureTrace(true)
                     .withFailureTraceCompression(false)
                     .withFormats(CONSOLE, HTML, STATS);
         }
     }

     private static class MyStoryControls extends StoryControls {

         public MyStoryControls() {

             doDryRun(false);
         }
     }
}

And I normally run this from Maven, using the jbehave-maven-plugin. I
think configuration there is also pretty simple:

<plugin>
     <groupId>org.jbehave</groupId>
     <artifactId>jbehave-maven-plugin</artifactId>
     <version>3.4.5</version>

     <dependencies>
         <dependency>
             <groupId>log4j</groupId>
             <artifactId>log4j</artifactId>
             <version>1.2.16</version>
         </dependency>
     </dependencies>

     <executions>
         <execution>
             <id>run-stories-as-embeddables</id>
             <phase>integration-test</phase>
             <configuration>
                 <includes>
                     <include>**/JBehaveTest.java</include>
                 </includes>

<annotatedEmbedderRunnerClass>ovi.maps.JBehaveTest</annotatedEmbedderRunnerClass>
                 <scope>test</scope>
             </configuration>
             <goals>
                 <goal>run-stories-with-annotated-embedder</goal>
             </goals>
         </execution>
     </executions>
</plugin>

Now, here's the problem I'm having:

If I run this from Maven, the build will succeed even though there are
Pending steps.

If I change ignoreFailureInStories to false, the build will fail but
the view will never be generated.


So, is there a way of getting the build to fail when there are Pending
steps *and* the view to still be generated? What am I doing wrong
here?


Thanks in advance,
L.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

     http://xircles.codehaus.org/manage_email





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to