LambdaTest Community

Find answers, support, and inspiration from other users

Questions
LambdaTest Community
Answered

How can I run parallel tests with JBehave?

I want to run parallel tests with jbehave. Can anyone tell me how to do it.

Up Vote Down Vote 0 Votes
Posted 4 months ago

Answers


I have some tests created with jBehave and WebDriver.

When I execute them via Maven, the execution is secuencially:

TEST 1

  • Open navigator
  • Execute all the steps of the first story
  • Close navigator

TEST 2

  • Open navigator
  • Execute all the steps of the second story
  • Close navigator ...

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>
Up Vote Down Vote 0 Votes
Posted 2 months ago