1
votes

Environment - Cucumber V. 4.2.3 | Selenium V.3.8.1 | JUnit V.4.12 | cucumber-jvm- parallel-plugin V.5.0.0 | maven-surefire-plugin V.2.22.1 | maven-compiler- plugin v.3.3

Seems like Maven Surefire is trying to configure TestNG with created runners by Cucumber-JVM Parallel Plugin. I want to run via Junit not by TestNG. Not sure, why its connecting to TestNG.

[INFO] Running TestSuite
Configuring TestNG with: TestNG60Configurator
[TestNG] [ERROR] No test suite found. Nothing to run
Usage: <main class> [options] The XML suite files to run

Configuring TestNG with: TestNG60Configurator
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.573 s - in TestSuite
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.108 s
[INFO] Finished at: 2019-02-18T00:28:10+05:30
[INFO] ------------------------------------------------------------------------

I have mentioned useTestNg as false in cucumber jvm parallel plugin.

Maven Surefire Plugin Configuration

        <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.22.1</version>
        <configuration>
            <forkCount>2</forkCount>
            <reuserForks>true</reuserForks>
            <includes>
                <include>**/Parallel*IT.class</include>
            </includes>
        </configuration>
    </plugin>

Cucumber JVM Parallel Plugin -

<plugin>
        <groupId>com.github.temyers</groupId>
        <artifactId>cucumber-jvm-parallel-plugin</artifactId>
        <version>5.0.0</version>
        <executions>
            <execution>
                <id>generateRunners</id>
                <phase>generate-test-sources</phase>
                <goals>
                    <goal>generateRunners</goal>
                </goals>
                <configuration>
                    <glue>
                        <package>com.jacksparrow.automation.steps_definitions.functional</package>
                    </glue>
                    <outputDirectory>${project.build.directory}/generated-test-sources/cucumber</outputDirectory>
                    <featuresDirectory>src/test/resources/features/functional/</featuresDirectory>
                    <cucumberOutputDir>target/cucumber-parallel</cucumberOutputDir>

                    <plugins>
                        <plugin>
                            <name>json</name>
                        </plugin>
                    </plugins>

                    <useTestNG>false</useTestNG>

                    <namingScheme>simple</namingScheme>
                    <!-- The class naming pattern to use. Only required/used if naming scheme 
                        is 'pattern'. -->
                    <namingPattern>Parallel{c}IT</namingPattern>

                    <!-- CucumberOptions.strict property -->
                    <strict>true</strict>
                    <!-- CucumberOptions.monochrome property -->
                    <monochrome>true</monochrome>
                </configuration>
            </execution>
        </executions>
    </plugin>

Can someone guide me why Surefire is trying to configure TestNG for running generated runners and at last it says Build Successful and No Test Case gets executed. Please guide.

2
I came across there could be chances where surefire is trying to connect to other provider i.e. testng in my case. Can someone guide me how shall i forcefully mention junit with in surefire. is below one correct for 4.12 <groupId>org.apache.maven.surefire</groupId> <artifactId>surefire-junit412</artifactId>TheSociety
Someone said in one of the post on github he was facing same problem until he had to add testng dependency. I did it as well (org.testng | testng | 6.9.4) but no luck so far and below are the Junit & TestNG dependency in my POM io.cucumber | cucumber-testng | 4.2.3 org.testng | testng | 6.9.4 io.cucumber | cucumber-junit | 4.2.3 | <scope>test</scope> junit | junit | 4.12TheSociety

2 Answers

0
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.

0
votes

Just wanted to put my 2 cents here, as this answer sent me into the right direction. I had 0 dependencies to TestNG (even the effective POM had none) and had no surefire configuration in my POM. I added a plugin in my POM configuring surefire (I googled maven surefire junit) and now the "test"-step wasn't referring to TestNG anymore.