Cucumber Scenarios not running in parallel when running from Testng

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Cucumber Scenarios not running in parallel when running from Testng

Rahul Kamboj

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 Testruuner I have metioned 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 the 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{
}

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Cucumber Scenarios not running in parallel when running from Testng

Krishnan Mahadevan
Rahul,

AFAIK parallel execution of scenarios is not supported by Cucumber (mainly because it's reporters aren't thread safe yet )

All said and done you can try using RoadRunner (https://github.com/RationaleEmotions/cucumber-roadrunner) that I built to solve this problem. 

It should let you run scenarios in a feature file in parallel and it also generates thread safe reports as well. 

Please give it a shot. If you find any issues please feel free to log bugs in that project and I will try to get to it asap. 

On Thu, Apr 5, 2018, 12:48 Rahul Kamboj <[hidden email]> wrote:

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 Testruuner I have metioned 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 the 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{
}

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
--

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Cucumber Scenarios not running in parallel when running from Testng

Rahul Kamboj
Thanks krishnan for the quick reply, i am gng to try that.
One more quick question, Can we run features in parallel ? Is it  possible that testng can create thread for each feature, so that we can have one thread for each feature in the testrunner.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Cucumber Scenarios not running in parallel when running from Testng

Krishnan Mahadevan
The current implementation doesn't support parallel feature execution. The change is trivial, but we need to check if thread safety is going to get broken anywhere.
I would request you to please help log a bug. I will try to get to it.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

On Thu, Apr 5, 2018 at 6:39 PM, Rahul Kamboj <[hidden email]> wrote:
Thanks krishnan for the quick reply, i am gng to try that.
One more quick question, Can we run features in parallel ? Is it  possible that testng can create thread for each feature, so that we can have one thread for each feature in the testrunner.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Cucumber Scenarios not running in parallel when running from Testng

Rahul Kamboj
In reply to this post by Rahul Kamboj

I have added the dependency for road runner in my pom and its complaining about the missing artifcat.







On Thursday, April 5, 2018 at 5:18:55 PM UTC+10, Rahul Kamboj wrote:

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 Testruuner I have metioned 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 the 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 "<a href="http://testng.org/testng-1.0.dtd" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ftestng.org%2Ftestng-1.0.dtd\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHihXzQ1YlwcxcDehnw97TuniFLA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ftestng.org%2Ftestng-1.0.dtd\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHihXzQ1YlwcxcDehnw97TuniFLA&#39;;return true;">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{
}

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Cucumber Scenarios not running in parallel when running from Testng

Krishnan Mahadevan

Rahul,

 

This is no longer a valid TestNG question, buts more of a question related to a third-party library (roadrunner in this case).

I wouldn’t want to hijack TestNG users forum for questions on a third party library. I would really suggest that you start filing issues for whatever queries you have on the github issues page (https://github.com/RationaleEmotions/cucumber-roadrunner/issues ).

 

To solve your problem please refer to here: https://stackoverflow.com/a/7717234

 

Let’s help keep the TestNG users forum relevant and clean.

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

Reply-To: <[hidden email]>
Date: Friday, April 6, 2018 at 7:40 AM
To: testng-users <[hidden email]>
Subject: [testng-users] Re: Cucumber Scenarios not running in parallel when running from Testng

 

I have added the dependency for road runner in my pom and its complaining about the missing artifcat.

 

 

 

https://lh3.googleusercontent.com/-Z0H86Pspj0A/WsbWn4jza2I/AAAAAAAAAbE/kTsEvBV3yWsAvprW_osz_e9i-PFOC_iDACLcBGAs/s320/Capture.PNG

https://lh3.googleusercontent.com/-Z0H86Pspj0A/WsbWn4jza2I/AAAAAAAAAbE/kTsEvBV3yWsAvprW_osz_e9i-PFOC_iDACLcBGAs/s320/Capture.PNG

 



On Thursday, April 5, 2018 at 5:18:55 PM UTC+10, Rahul Kamboj wrote:

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 Testruuner I have metioned 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 the 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{
}

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
[hidden email].
To post to this group, send email to
[hidden email].
Visit this group at
https://groups.google.com/group/testng-users.
For more options, visit
https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.