How to run multiple tests simultaneously with jBehave?

I have some tests created using jBehave and WebDriver.

When I execute them through Maven, the execution is essentially done:

TEST 1

  • Open the navigator
  • Complete all the steps of the first story.
  • Close navigator

TEST 2

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

...

I am interested in running tests at the same time. According to the documentation, this is possible.

http://jbehave.org/reference/stable/multi-threading.html

I tried adding the notation to the "Stories" class, and also executed the mvn command with streams = 5, but it does not 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

Can I run multiple tests at the same time?

EDIT:

Added 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>
+5
source share
2 answers

, , run-stories-as-embeddables. :

  • run-stories-as-embeddables "threads" . Maven Gaols:

    <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>
    
  • maven run-stories-with-annotated-embedder,

, , , . Mutli-threading . .

+2

Spring JUnit test runner .useThreads(20)

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {
    ...
})
public class Stories extends JUnitStories {

    @Before
    public void setUp() throws Exception {
        configuredEmbedder()
                .embedderControls()
                ...
                .useThreads(20)
                .useStoryTimeouts(Integer.toString(maxIfDebugOr(1800)));
    }
...
0

All Articles