For days I've been trying to run web tests parallel in a framework built upon Selenium WebDriver, JBehave and Serenity BDD. After reading through many articles and implementing them I'm still unable to run web tests in parallel.

I would appreciate if anyone could conceptually or practically make me understand the changes I need to make to allow parallel execution in the framework.

I have already read and tried implementing the solution mentioned in the following articles but to no avail: <http://mdolinin.github.io/blog/2014/01/17/thucydides-plus-jbehave-plus-maven-run-tests-in-parallel/>
The above article uses `ThucydidesJUnitStory` class, but since it has been deprecated I used `SerenityStory` class instead. It still did not work.

**Structure:**

```
Project
|-- src/test/java
|---- com.auto.test.app
|-------- AcceptanceTestSuite.java
|---- com.auto.test.app.definitions
|-------- SearchDefinitions.java
|---- com.auto.test.app.definitions.steps
|-------- SearchSteps.java
|---- src/test/resources
|-------- stories
|------------ AcceptanceTestSuite
|---------------- BasicSearch.story
|---------------- AdvancedSearch.story
|---- src/main/java
|-------- com.auto.test.app.pages
|------------ HomePage.java
|-------- com.auto.test.app.pages.objects
|------------ HomePageOR.java
|---- drivers
|-------- ChromeDriver.exe
|---- pom.xml
|---- serenity.properties

```

**pom.xml**

```
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.auto.test</groupId>
    <artifactId>Serenity_TAF</artifactId>
    <version>1.0</version>
    <packaging>jar</packaging>

    <name>Serenity Test Automation Framework</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <serenity.version>1.1.17</serenity.version>
        <serenity.jbehave.version>1.1.0</serenity.jbehave.version>
        <webdriver.driver>chrome</webdriver.driver>
        <webdriver.chrome.driver>./drivers/chromedriver.exe</webdriver.chrome.driver>
    </properties>

    <repositories>
        <repository>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <id>central</id>
            <name>bintray</name>
            <url>http://jcenter.bintray.com</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <id>central</id>
            <name>bintray-plugins</name>
            <url>http://jcenter.bintray.com</url>
        </pluginRepository>
    </pluginRepositories>

    <dependencies>
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-core</artifactId>
            <version>${serenity.version}</version>
        </dependency>
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-junit</artifactId>
            <version>${serenity.version}</version>
        </dependency>
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-jbehave</artifactId>
            <version>${serenity.jbehave.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <version>2.5</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>2.5</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j-impl</artifactId>
            <version>2.5</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>1.7.0</version>
        </dependency>
        <dependency>
            <groupId>com.googlecode.lambdaj</groupId>
            <artifactId>lambdaj</artifactId>
            <version>2.3.3</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.18.1</version>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.18.1</version>
                <configuration>
                    <systemPropertyVariables>
                        <webdriver.driver>${webdriver.driver}</webdriver.driver>
                    </systemPropertyVariables>
                    <includes>
                        <include>**/*Test.java</include>
                        <include>**/*TestSuite.java</include>
                        <include>**/Test*.java</include>
                        <include>**/When*.java</include>
                    </includes>
                    <!--  <forkMode>perthread</forkMode> -->
                    <parallel>classes</parallel>
                    <threadCount>2</threadCount>                    
                    <argLine>-Xmx512m</argLine>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.2</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>net.serenity-bdd.maven.plugins</groupId>
                <artifactId>serenity-maven-plugin</artifactId>
                <version>${serenity.version}</version>
                <executions>
                    <execution>
                        <id>serenity-reports</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>aggregate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

```

**serenity.properties**

```
# Define the default driver
webdriver.driver=chrome
webdriver.chrome.driver=drivers/chromedriver.exe
webdriver.base.url=https://www.google.com/

# Appears at the top of the reports
serenity.project.name=Serenity & Java based Test Automation Framework

# Run the tests without calling WebDriver - useful to check your JBehave wiring
#serenity.dry.run=true
story.timeout.in.secs=3600
thucycides.step.delay=1000
webdriver.timeouts.implicitlywait=10000
webdriver.wait.for.timeout=60000
#serenity.timeout=10000

# Customize browser size
#serenity.browser.height = 1004
#serenity.browser.width = 1920

security.enable_java=true

serenity.take.screenshots=AFTER_EACH_STEP
serenity.reports.show.step.details=false
serenity.report.show.manual.tests=false
serenity.resized.image.width=1920
serenity.keep.unscaled.screenshots=true
serenity.maintain.session=true

```