1
votes

Using testng to run cucumber features through Maven. Tests are not running and just shows zero run in console(output below).


T E S T S


Running TestSuite Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.421 sec - in TestSuite

Results :

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

[INFO] ------------------------------------------------------------------------

[INFO] BUILD SUCCESS

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 2.507s

[INFO] Finished at: Thu Sep 01 17:24:45 IST 2016

[INFO] Final Memory: 8M/155M

[INFO] ------------------------------------------------------------------------

This is the POM.xml

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.18.1</version>
            <configuration>
                <suiteXmlFiles>
                    <suiteXmlFile>src/test/java/resources/TestSuite.xml</suiteXmlFile>
                </suiteXmlFiles>
            </configuration>
        </plugin>

    </plugins>

</build>

<dependencies>

    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>18.0</version>
    </dependency>

    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.8.21</version>
    </dependency>

    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-testng</artifactId>
        <version>1.2.4</version>
    </dependency>

    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>1.2.4</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest-all</artifactId>
        <version>1.3</version>
    </dependency>

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>2.53.0</version> 
</dependency>

TestNG xml

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Test runner">
<test name="Package with subpackages">
    <packages>
        <package name="src.test.java.runner.*"/>
    </packages>
</test> 
</suite>

Runner class code

import cucumber.api.CucumberOptions;
import cucumber.api.testng.AbstractTestNGCucumberTests;


@CucumberOptions (features ="src/test/java/features/NewClientWorkflow.feature",
format = {"pretty", "html:target/cucumber", "json:target/cucumber-  report.json"},
monochrome = true,
glue={"steps"})
public class RunFeaturesTest extends AbstractTestNGCucumberTests{
}

Tried the Cucumber + Maven + TestNG combination by following the below link https://automatictester.co.uk/2015/06/11/basic-cucumberjvm-selenium-webdriver-test-automation-framework/

1

1 Answers

1
votes

You asked to run <package name="src.test.java.runner.*"/>.

As you use maven, the default folder for tests is src/test/java.

You didn't share the package line of your test, but I can't imagine it starts by package src.test.java.runner....

Try to run your tests with <package name="runner.*"/> instead.