Skip to content
This repository has been archived by the owner on Nov 23, 2021. It is now read-only.

Working with multiple threads

kkarolk edited this page Jul 22, 2016 · 5 revisions

Multi-threaded tests

You can execute your tests in parallel from both jUnit and Cucumber approaches

There are two things that you need to do to run tests in parallel:

  • tell Bobcat in how many threads it should run the tests,
  • provide a test suite that supports multi-threading

jUnit

Defining number of threads

You can use a property to define number of threads. Add the following line to one of your property files:

thread.count=3

If you run your tests from the command line (for example in Jenkins), you can also define number of threads from command line:

mvn clean test -PsomeProfile -Dthread.count=3

For this to work, you need following line in your POM, in Surefire's configuration section:

<thread.count>${thread.count}</thread.count>

Concurrent suite runner

ConcurrentSuite runner will run all test methods from one test class in one thread, in sequence.

@Modules(GuiceModule.class)
@RunWith(ConcurrentSuite.class)
@Suite.SuiteClasses({
        // some classes
})
public class MySuite {
    // empty
}

Cucumber

To run Cucumber tests in parallel you should define fork.count configuration option for your test suite. This option can be defined under maven-surefire-plugin configuration in pom.xml file as shown below:

 <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.16</version>
    <configuration>
        <forkCount>${fork.count}</forkCount>
        <systemPropertyVariables>
            <webDriver.type>${webDriver.type}</webDriver.type>
            <configuration.paths>${configuration.paths}</configuration.paths>
            <content.path>${content.path}</content.path>
        </systemPropertyVariables>
    </configuration>
  </plugin>

Getting started with Bobcat

  1. Getting started

AEM Related Features

  1. Authoring tutorial - Classic
  1. AEM Classic Authoring Advanced usage
  1. Authoring tutorial - Touch UI
Clone this wiki locally