0
votes

I am new to maven and I have used cucumber-jvm-parallel-plugin:4.2.0 version to auto generate runner class and run feature files in parallel, but its throwing below error stack

[ERROR] Failed to execute goal com.github.temyers:cucumber-jvm-parallel-plugin:4.2.0:generateRunners (generateRunners) on project JUnitCucumberParallelExecutionPractise: Features directory does not exist -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

<properties>
    <src.main.java>src/main/java</src.main.java>
</properties>

<build>
    <resources>
        <resource>
            <directory>${src.main.java}</directory>
        </resource>
    </resources>

    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>1.7</version>
            <executions>
                <execution>
                    <id>add-source</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>add-source</goal>
                    </goals>
                    <configuration>
                        <sources>
                            <source>src/main/java/</source>
                            <source>src/main/resources/</source>
                            <source>com.qa.features</source>
                        </sources>
                    </configuration>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
                <fork>true</fork>
                <executable>C:\Program Files (x86)\Java\jdk1.8.0_211\bin\javac</executable>
            </configuration>
        </plugin>

        <plugin>
            <groupId>com.github.temyers</groupId>
            <artifactId>cucumber-jvm-parallel-plugin</artifactId>
            <version> 4.2.0</version>
            <executions>
                <execution>
                    <id>generateRunners</id>
                    <phase>generate-test-sources</phase>
                    <goals>
                        <goal>generateRunners</goal>
                    </goals>
                    <configuration>
                        <featuresDirectory>${src.main.java}/com.qa.features</featuresDirectory>
                        <glue>
                            <package>com.qa.stepdef</package>
                        </glue>
                        <outputDirectory>${project.build.directory}/generated-test-sources/cucumber</outputDirectory>
                        <cucumberOutputDir>${project.build.directory}</cucumberOutputDir>
                        <format> json </format>
                        <strict>true</strict>
                        <monochrome>false</monochrome>
                        <useTestNG>false</useTestNG>
                        <namingScheme>simple</namingScheme>
                        <namingPattern>Parallel{c}IT</namingPattern>
                        <parallelScheme>FEATURE</parallelScheme>
                    </configuration>
                </execution>
            </executions>
        </plugin>



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

            <configuration>
                <forkCount>5</forkCount>
                <reuseForks>true</reuseForks>
                <includes>
                    <include>**/*IT.class</include>
                </includes>
            </configuration>
        </plugin>

    </plugins>
</build>

Expected: Plugin should recognize my feature files in the path mentioned in ${src.main.java}/com.qa.features Actual: Feature files are not recognized

1

1 Answers

0
votes

You need to add below tag in cucumber-jvm-parallel-plugin plug-in

<featuresDirectory>src/main/resources/Feature</featuresDirectory>

Full plugin like:

<plugin>
                <groupId>com.github.temyers</groupId>
                <artifactId>cucumber-jvm-parallel-plugin</artifactId>
                <version>4.1.0</version>
                <executions>
                    <execution>
                        <id>generateRunners</id>
                        <phase>generate-test-sources</phase>
                        <goals>
                            <goal>generateRunners</goal>
                        </goals>
                        <configuration>
                            <glue>
                                <package>${gluePackage}</package>
                            </glue>
                            <outputDirectory>${project.build.directory}/generated-test-sources/cucumber</outputDirectory>
                            <featuresDirectory>${featuresDir}</featuresDirectory>
                            <cucumberOutputDir>target/cucumber-parallel</cucumberOutputDir>
                            <plugins>
                                <plugin>
                                    <name>json</name>
                                </plugin>
                            </plugins>
                            <strict>true</strict>
                            <monochrome>true</monochrome>
                            <tags>
                                <tag>${tag1}</tag>
                            </tags>
                            <!-- <tags> <tag>${tags}</tag> <tag>~@ignore</tag> </tags> -->
                            <useTestNG>false</useTestNG>
                            <namingScheme>simple</namingScheme>
                            <namingPattern>Parallel{c}IT</namingPattern>
                            <parallelScheme>FEATURE</parallelScheme>
                            <customVmTemplate></customVmTemplate>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

Result after changes done as suggested by Shubham Jain enter image description here