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.