0
votes

Not able to connect what all i shall follow to implement cucumber-jvm version 4.2.3 parallel execution

My Environment - Cucumber V 4.2.3 | Selenium V 3.8.1 | Junit - 4.2

Below is the output from eclipse console. Nothing gets executed however

    [INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ TheDayAfterTomorrow ---
    [INFO] Changes detected - recompiling the module!
    [INFO] Compiling 14 source files to D:\photon-workspace\TheDayAfterTomorrow\target\test-classes
    [INFO] 
    [INFO] --- maven-surefire-plugin:2.19:test (default-test) @ TheDayAfterTomorrow ---
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 5.986 s
    [INFO] Finished at: 2019-02-18T23:18:26+05:30
    [INFO] ------------------------------------------------------------------------

I am using Pico Container as well to implement DI.

Here is my RunCuke implementation

    package com.jacksparrow.automation.suite.runner;

    import org.junit.runner.RunWith;
    import cucumber.api.CucumberOptions;
    import cucumber.api.junit.Cucumber;

    @RunWith(Cucumber.class)
    @CucumberOptions(features = "classpath:features/functional/",
                         glue = {"com.jacksparrow.automation.steps_definitions.functional" },
                       plugin = { "pretty","json:target/cucumber-json/cucumber.json",
                                  "junit:target/Cucumber.xml", "html:target/cucumber-reports"},
                       strict = false,
                       dryRun = false,
                   monochrome = true)

    public class FunctionalRunCuke {
    }

POM.XML

        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>4.2.3</version>
        </dependency>

        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-junit</artifactId>
            <version>4.2.3</version>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
        </dependency>

        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>datatable</artifactId>
            <version>1.1.12</version>
        </dependency>

        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-testng</artifactId>
            <version>4.2.3</version>
        </dependency>

        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-picocontainer</artifactId>
            <version>4.2.3</version>
        </dependency>

        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>${selenium.version}</version>
        </dependency>

        <dependency>
            <groupId>io.github.bonigarcia</groupId>
            <artifactId>webdrivermanager</artifactId>
            <version>3.0.0</version>
        </dependency>

Maven Compiler Plugin

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <compilerVersion>1.8</compilerVersion>
                </configuration>
        </plugin>

Maven-Surefire-Plugin

           <plugin>
               <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.19</version>

                <configuration>
                    <parallel>methods</parallel>
                    <threadCount>4</threadCount>
                </configuration>
            </plugin>

Please guide what is missing here or what are steps to implement cucumber-jvm v4 parallel execution. If someone can share detailed steps, it would be grateful as I have been trying to implement it for 1 week but no success so far.

1
Try appending the runner class name with 'Test' to get picked up aitomatically by surefire. Is this class in the src/test/java folder structure?Grasshopper
Hey @Grasshopper, I added runner file name. However, it is still only executing one feature at a time when i run Maven. Do we need to add cucumber-jvm jar as well to make it run ? and In my POM, I also having maven-compiler plugin. Hope it shall not impact and Cucumber-Junit V is 4.2.3/4.0.0. and JUnit 4.12. Please guide what is wrong here. I have tried cucumber both V4.0.0 & V4.2.3 <includes> <include>**/*RunCukeTest.java</include> </includes>TheSociety
Have followed this link github.com/cucumber/cucumber-jvm/tree/v4.0.0/junit as well. But no luck so farTheSociety
My mind is thinking is there any specific dependency i am missing. do we need to add <dependency> (tried but no luck) <groupId>io.cucumber</groupId> <artifactId>cucumber-jvm</artifactId> <version>4.0.0</version> <type>pom</type> </dependency> <dependency> <groupId>io.cucumber</groupId> <artifactId>cucumber-core</artifactId> <version>4.0.0</version> </dependency>TheSociety
Maybe u need to remove the cucumber-testng dependency. Have u tried running simple junit tests in parallel without any cucumber stuff.Grasshopper

1 Answers

1
votes

Issue was because of Dependency on testNG causes Surefire to ignore JUnit wrapper class. I removed all the TestNG dependencies or you can take a call to 2 define 2 execution - For TestNG & JUnit and disable one as per your need and I am using Maven Surefire Version 3.0.0-M3