I have some tests created with jBehave and WebDriver.
When I execute them via Maven, the execution is secuencially:
TEST 1
TEST 2
...
I'm interested in execute the tests simultaneously. According the documentation, this is possible.
http://jbehave.org/reference/stable/multi-threading.html
I've tried adding the notation to the "Stories" class, and also executed the mvn command with the threads=5, but doesn't work.
@UsingEmbedder(threads=5)
public class EtsyDotComStories extends JUnitStories {
...
@Override
protected List<String> storyPaths() {
return new StoryFinder().findPaths(codeLocationFromClass(this.getClass()).getFile(), asList("**/*.story"), null);
}
}
mvn clean install -s settings.xml -Pjava-spring,codehaus,threads=5
Is it possible to execute multiple tests simultaneously?
EDIT:
Added the maven execution part:
<plugins>
<plugin>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-maven-plugin</artifactId>
<version>${jbehave.core.version}</version>
<executions>
<execution>
<id>embeddable-stories</id>
<phase>integration-test</phase>
<configuration>
<includes>
<include>**/*Stories.java</include>
</includes>
<ignoreFailureInStories>true</ignoreFailureInStories>
<ignoreFailureInView>false</ignoreFailureInView>
<threads>5</threads>
<executorsClass>org.jbehave.core.embedder.executors.SameThreadExecutors</executorsClass>
</configuration>
<goals>
<goal>run-stories-as-embeddables</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>11.0.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
To run multiple stories in JBehave, you can use the Ant task or Maven task. But you need to specify your story's location and which configuration should be used for its execution.
Multiple running modes as embeddables: An Embeddable is an abstraction of a running mode, which can run a single story, e.g. if extending JUnitStory or can run multiple stories, e.g. if extending JUnitStories. The Embeddable instances allow their configuration.
In order to use @skip or @ignore true meta in a story to skip this story, you need to configure a meta filter in configuration of your test. Looks cool, although still not obvious how to set the embedder globally and where to put the cod and how to configure JBehave to see this Embedder.
Your question could contain a little more detail, but I assume that you are using run-stories-as-embeddables goal. You basically have two options:
When using the run-stories-as-embeddables goal, set the property "threads" to the goal. Extending the example from the Maven Gaols documentation:
<plugin>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-maven-plugin</artifactId>
<version>[version]</version>
<executions>
<execution>
<id>run-stories-as-embeddables</id>
<phase>integration-test</phase>
<configuration>
<includes>
<include>**/*Stories.java</include>
</includes>
<ignoreFailureInStories>true</ignoreFailureInStories>
<ignoreFailureInView>false</ignoreFailureInView>
<treads>5</threads>
</configuration>
<goals>
<goal>run-stories-as-embeddables</goal>
</goals>
</execution>
</executions>
</plugin>
Use the run-stories-with-annotated-embedder maven goal, which should respect the Annotation
Also, the two scenarios that you describe above have to be in two seperate stories. Mutli-threading only happens on story-level. Scenarios inside the same story are not executed multi-threaded.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With