I am having 2 feature files and i want to execute parallely through testng. If i execute mvn test it shows Build Success but it doesn't execute Test cases. Could anybody helpout on this? Please find below my structure.
TestNG.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name = "FlipkartSmoke" verbose="1" thread-count="2" parallel="methods">
<test name = "FlipkartLogin">
<classes>
<class name="runner.testrunner">
</class>
</classes>
</test>
</suite>
testrunner.java:
import cucumber.api.CucumberOptions;
import cucumber.api.testng.AbstractTestNGCucumberTests;
@CucumberOptions(
features="src\\test\\java\\features",
glue= {"seleniumGlueCode"},
format= {"html:target"},
monochrome=true,
dryRun=false
)
public class testrunner extends AbstractTestNGCucumberTests{
}
pom.xml:
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<includes>
<include>TestNG.xml</include>
</includes>
</configuration>
</plugin>
pom.xml:
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<!-- ******************************************************************************** -->
<!-- Selenium Dependencies -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.7.0</version>
</dependency>
<!-- ******************************************************************************** -->
<!-- Cucumber Dependencies -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-core</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm-deps</artifactId>
<version>1.0.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>gherkin</artifactId>
<version>13.0.0</version>
</dependency>
<!-- ******************************************************************************** -->
<!-- TestNG Dependencies -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-testng</artifactId>
<version>4.2.0</version>
</dependency>
<!-- ******************************************************************************** -->
<!-- Excel Read Dependencies -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.1.1</version>
</dependency>
<!-- ******************************************************************************** -->
<!-- Common io Dependencies -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
</dependencies>
It is showing build success. But it is not executing test cases.But if i try with @runWith in testrunner as junit testcase means, Both feature files are executing.
I think you are mixing JUnit testing and TestNG testing with the Surefire plugin. Even you are mixing "includes" with "suiteXmlFiles". So my advice for you would be to stop and read documentation, and write little Maven project with almost no Java code or minimum code and get the POM right working with the command mvn test. It is very important to get the basic project working properly and understand. https://maven.apache.org/surefire/maven-surefire-plugin/examples/testng.html Staring with a lot of messy dependencies and code makes it a mess in your head anyway. Therefore start it with the basic staff.