0
votes

When I am running the cucumber test from testng.xml, scenarios are not executed in parallel. Scenarios are executed one after another. I am using the threads and parallel configuration in testng.xml file and using the surefire plugin for running the features. In the Testrunner I have mentioned the website folder where I have got multiple feature file.

So when I run the test using Maven, it always executes the feature files one after another and not in parallel. What's the best way to achieve that?

Please check below configuration:

**Version of testng:**
<org.testng.testng.version>6.14.2</org.testng.testng.version>
<io.cucumber.cucumber-testng.version>2.4.0</io.cucumber.cucumber-testng.version>


**Surefire Plugin configuration from pom.xml:**
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version></version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>Testng.xml</suiteXmlFile>
</suiteXmlFiles>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>


**Testng.xml file:**
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Local" parallel="tests" thread-count="5" verbose="2">
<listeners>
<listener class-name="driver.LocalWebDriverListener" />
<listener class-name="reports.ExecutionListeners" />
</listeners>
<test name="Test in Chrome">
<parameter name="browserName" value="chrome" />
<classes>
<class name="testRunner.Windows7Chrome60" />
</classes>
</test>
</suite>

**TestRunner file in which Website is the folder where I have got multiple features:**
@CucumberOptions(
strict = true, 
monochrome = true, 
features = {"src/main/java/features/Website"},
dryRun = false, 
glue = {"driver", "stepDefination", "testRunner" }, 
tags = {},
plugin = { "pretty",  "json:target/RawJsonResult/Windows7Chrome60.json"}
)
public class Windows7Chrome60 extends AbstractTestNGCucumberTests{
}
1
You have only one test tag in the testng.xml and parallel is set to "tests". Have you tried with parallel to "methods" - Grasshopper
Yeah, I have tried with the methods, With the methods as well it executes the scenarios one by one but not parallelly. What I am looking for is to call test runner from testng.xml and run all the features we have in that testrunner in parallel. - Rahul Kamboj
Afaik Cucumber does not support parallel execution. You might need to use an additional plugin like this one - Marit

1 Answers

0
votes

I agrre with @Marit that Cucumber does not support parallel execution. You might need to use an additional plugin. You can use gherkin with qaf or qaf-bdd which supports scenario level parallel execution and all features of TestNG.