0

I want to run my cucumber JVM test parallel in different browsers (Firefox and chrome) for that I have runner file as below for each browser followed by my pom.xml settings.

@RunWith(Cucumber.class) @CucumberOptions( format = {"pretty", "html:target/cucumber-report", "json:target/cucumber-report.json"}, features = {"classpath:acceptance/feature"}, glue = {""}, tags = {"@chrome"}, strict = true)

public class AcceptanceITCaseTest2 {

@AfterClass
public static void afterClass() {
    if(getDriver()!=null) {
        getDriver().manage().deleteAllCookies();
        getDriver().quit();
    }
}

}

pom.xml

 <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>1.7</version>
            <executions>
                <execution>
                    <id>add-integration-test-sources</id>
                    <phase>generate-test-sources</phase>
                    <goals>
                        <goal>add-test-source</goal>
                    </goals>
                    <configuration>
                        <sources>
                            <source>src/test/ac/java/acceptance</source>
                            <source>src/test/ac/java</source>
                        </sources>
                    </configuration>
                </execution>
            </executions>
        </plugin>enter code here
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>2.19.1</version>
            <executions>
                <execution>
                    <id>acceptance-tests</id>
                    <phase>integration-test</phase>
                    <goals>
                        <goal>test</goal>
                    </goals>
                    <configuration>
                        <parallel>classes</parallel>
                        <forkCount>2</forkCount>
                        <reuseForks>false</reuseForks>
                        <useFile>false</useFile>
                        <testFailureIgnore>true</testFailureIgnore>
                    </configuration>
                </execution>
            </executions>
        </plugin>

command:

mvn test -Dit.test=AcceptanceITCaseTest1,AcceptanceITCaseTest2 -P test

output-

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.002s
[INFO] Finished at: Tue Jun 21 13:43:59 BST 2016
[INFO] Final Memory: 27M/260M

Can anyone please let me know what I'm missing here? Why I'm not able to kick the 2 separate runners in parallel here?

Any help is appreciated.

Thanks.

tyro
  • 577
  • 8
  • 17
  • Hope this will help you: https://opencredo.com/running-cucumber-jvm-tests-in-parallel/ – Ranjith's Jun 22 '16 at 11:16
  • Have seen this page but this seems to create runner files run time which isn't helpful for us. We are using cucumber JVM framework, and we need to execute scripts strictly on different browser for which we need separate runner file. Thanks for your response though. – tyro Jul 06 '16 at 13:01
  • 1
    Hello, have a look at http://stackoverflow.com/a/41100104/2895913 i have explained in detail. – Sugat Mankar Dec 21 '16 at 13:27

1 Answers1

0

try to put below mentioned includes in your configuration block in the maven-surefire plugin

<includes>
     <include>*Test*.class</include>
</includes>
manishgdev
  • 148
  • 3
  • 12