Hi Julien,

difficult to help you if you don't provide a self-contained project (not just the config) reproducing your behaviour and provide us with infos on the running env, OS, version etc ...

OTOH, I'd say it could be that the StepFinder returns an empty list because of some peculiarity in your config.

Are you sure the story files are copied to the target/classes directory? I'd put a breakpoint in storyPaths() to investigate.

Also, depending on the version of JBehave you're using, on Windows spaces in the paths could lead to story paths not being found.

Cheers

On 30/09/2012 09:16, Julien Martin wrote:
Hello,

I have a configuration issue with JBehave: only BeforeStories and AfterStories are run. It seems my stories (*.story) are not found.. They are located in this package: *com.kadjoukor.jbehave.stories*

I think the problem started occuring after I added the failsafe and jbehave plugins in my maven config.

Here is my java config:*

public class KadjoukorWebStories extends JUnitStories {

private WebDriverProvider driverProvider = new PropertyWebDriverProvider(); private WebDriverSteps lifecycleSteps = new PerStoriesWebDriverSteps(driverProvider); // or
                                // PerStoryWebDriverSteps(driverProvider)
    private Pages pages = new Pages(driverProvider);
    private SeleniumContext context = new SeleniumContext();
private ContextView contextView = new LocalFrameContextView().sized(500, 100);

    public KadjoukorWebStories() {
// If configuring lifecycle per-stories, you need to ensure that you a
        // same-thread executor
        if (lifecycleSteps instanceof PerStoriesWebDriverSteps) {
configuredEmbedder().useExecutorService(MoreExecutors.sameThreadExecutor());
        }
    }

    @Override
    public Configuration configuration() {
        Class<? extends Embeddable> embeddableClass = this.getClass();
        return new SeleniumConfiguration()
                .useSeleniumContext(context)
                .useWebDriverProvider(driverProvider)
.useStepMonitor(new SeleniumStepMonitor(contextView, context, new SilentStepMonitor()))
                .useStoryLoader(new LoadFromClasspath(embeddableClass))
                .useStoryReporterBuilder(
new StoryReporterBuilder().withCodeLocation(codeLocationFromClass(embeddableClass)).withDefaultFormats()
                                .withFormats(CONSOLE, TXT, HTML, XML));
    }

    @Override
    public InjectableStepsFactory stepsFactory() {
        Configuration configuration = configuration();
return new InstanceStepsFactory(configuration, new KadjoukorWebSteps(pages), lifecycleSteps, new WebDriverScreenshotOnFailure(driverProvider,
                configuration.storyReporterBuilder()));
    }

    @Override
    protected List<String> storyPaths() {
return new StoryFinder().findPaths(codeLocationFromClass(this.getClass()).getFile(), asList("**/*.story"), null);
    }

// This Embedder is used by Maven or Ant and it will override anything set
    // in the constructor
    public static class SameThreadEmbedder extends Embedder {
        public SameThreadEmbedder() {
useExecutorService(MoreExecutors.sameThreadExecutor());
        }
    }
}*


Here is my Maven configuration:

*<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.0</version>
                <configuration>
                    <fork>true</fork>
                </configuration>
                <executions>
                    <execution>
                        <id>start-tomcat</id>
<phase>pre-integration-test</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>stop-tomcat</id>
<phase>post-integration-test</phase>
                        <goals>
                            <goal>shutdown</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.jbehave</groupId>
<artifactId>jbehave-maven-plugin</artifactId>
                <version>3.6.9</version>
                <executions>
                    <execution>
                        <id>run-stories</id>
<phase>integration-test</phase>
                        <configuration>
                            <includes>
<include>**/*Stories.java</include>
                            </includes>
<executorsClass>org.jbehave.core.embedder.executors.SameThreadExecutors</executorsClass>
                            <scope>test</scope>
                            <systemProperties>
                                <property>
<name>java.awt.headless</name>
<value>false</value>
                                </property>
                            </systemProperties>
<ignoreFailureInStories>false</ignoreFailureInStories>
<ignoreFailureInView>false</ignoreFailureInView>
                        </configuration>
                        <goals>
<goal>run-stories-as-embeddables</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>log4j</groupId>
<artifactId>log4j</artifactId>
                        <version>1.2.16</version>
                    </dependency>
                    <dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
                        <version>11.0.1</version>
                    </dependency>
                    <dependency>
<groupId>org.jbehave.web</groupId>
<artifactId>jbehave-web-selenium</artifactId>
                        <version>3.5.4</version>
                    </dependency>
                </dependencies>
            </plugin>
*

Can anyone please help?
Regards,
Julien.

Reply via email to