How do I run web tests in parallel in Selenium WebDriver, JBehave & Serenity BDD framework?
<p>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.</p>

<p>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.</p>

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

<p><strong>Structure:</strong></p>

<pre><code>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
</code></pre>

<p><strong>pom.xml</strong></p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;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"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;groupId&gt;com.auto.test&lt;/groupId&gt;
    &lt;artifactId&gt;Serenity_TAF&lt;/artifactId&gt;
    &lt;version&gt;1.0&lt;/version&gt;
    &lt;packaging&gt;jar&lt;/packaging&gt;

    &lt;name&gt;Serenity Test Automation Framework&lt;/name&gt;

    &lt;properties&gt;
        &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
        &lt;serenity.version&gt;1.1.17&lt;/serenity.version&gt;
        &lt;serenity.jbehave.version&gt;1.1.0&lt;/serenity.jbehave.version&gt;
        &lt;webdriver.driver&gt;chrome&lt;/webdriver.driver&gt;
        &lt;webdriver.chrome.driver&gt;./drivers/chromedriver.exe&lt;/webdriver.chrome.driver&gt;
    &lt;/properties&gt;

    &lt;repositories&gt;
        &lt;repository&gt;
            &lt;snapshots&gt;
                &lt;enabled&gt;false&lt;/enabled&gt;
            &lt;/snapshots&gt;
            &lt;id&gt;central&lt;/id&gt;
            &lt;name&gt;bintray&lt;/name&gt;
            &lt;url&gt;http://jcenter.bintray.com&lt;/url&gt;
        &lt;/repository&gt;
    &lt;/repositories&gt;
    &lt;pluginRepositories&gt;
        &lt;pluginRepository&gt;
            &lt;snapshots&gt;
                &lt;enabled&gt;false&lt;/enabled&gt;
            &lt;/snapshots&gt;
            &lt;id&gt;central&lt;/id&gt;
            &lt;name&gt;bintray-plugins&lt;/name&gt;
            &lt;url&gt;http://jcenter.bintray.com&lt;/url&gt;
        &lt;/pluginRepository&gt;
    &lt;/pluginRepositories&gt;

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

<p><strong>serenity.properties</strong></p>

<pre><code># 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 &amp; 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
</code></pre>