Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running Cucumber Features in Parallel from TestRunner #1343

Closed
rahulkamboj14 opened this issue Apr 9, 2018 · 4 comments
Closed

Running Cucumber Features in Parallel from TestRunner #1343

rahulkamboj14 opened this issue Apr 9, 2018 · 4 comments

Comments

@rahulkamboj14
Copy link

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.

Expected Behavior

thread should be created for every feature in the test runner so that all the features can be run parallelly

Current Behavior

features are not running in parallel and running one after another.

Possible Solution

Steps to Reproduce (for bugs)

Please have a look at the below configuration to replicate this issue

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{
}

Context & Motivation

trying to run the features in testrunner parallelly on multiple instances of browsers.

Your Environment

  • Version used: cucumber-testng 2.4.0
  • Operating System and version: Windows7
@mpkorstanje
Copy link
Contributor

mpkorstanje commented Apr 9, 2018

While you can run multiple instances of the Runtime concurrently Cucumber doesn't support concurrent execution of the same Runtime.

As such you may have some luck adapting the RunCukesByCompositionTest to use @DataProvider(parallel=true). You'll then have to fix the JSONFormatter to ensure the different instances of the Runtime don't overwrite each others results when writing to the same file.

You can also try the cucumber-jvm-parallel-plugin.

@rahulkamboj14
Copy link
Author

@mpkorstanje ..Thanks for a quick reply, I tried the cucumber-jvm-parallel-plugin and it worked fine but showing json filename as device name. Is it possible to change that.?
Also when running testrunner on the different browser at same time its overriding json and only keeping the latest. Not sure how to fix the JSONFormatter to not to override results.

@mpkorstanje
Copy link
Contributor

I can't really help you with that. This also isn't really the place for general advice. You can try the mailing list, slack of stackoverflow. Anyway. It's a maven plugin, try a maven profile or some such. And perhaps use different file names for each run/instance.

@lock
Copy link

lock bot commented Apr 10, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants