TestNG+Cucumber parallel tests run on same chrome instance
Whenever we run our test suite in parallel as "tests" with the TestNG xml file, it opens both instances of a chrome driver, but intermediately executes both cucumber features in the same window of chrome.
Gives us some result like this:
Searches two times in the search bar
This are Maven dependencies we have:
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm-deps</artifactId>
<version>1.0.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-testng</artifactId>
<version>1.2.5</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
We use a test runner for each test. All test runners are basically the same. Here is a test runner used:
package bdxReport.biAdsDashboard.AdvertisingPerformance.Content;
import cucumber.api.CucumberOptions;
import org.testng.annotations.Test;
@CucumberOptions(
features = "src/test/resources/FeaturesAdsDashboard/FeaturesAdvertisingPerformance/Content/CheckContentAdvertisingByProduct.feature",
glue = {"stepDefinitions"},
format = {
"pretty",
"html:target/cucumber-reports/AdsDashboard/TestRunnerCheckContentAdvertisingByProduct-Reports",
"json:target/cucumber-reports/AdsDashboard/TestRunnerCheckContentAdvertisingByProductReport.json",
"rerun:target/cucumber-reports/AdsDashboard/TestRunnerCheckContentAdvertisingByProduct-Reports/rerun.txt"
})
@Test
public class TestRunnerCheckContentAdvertisingByProduct {
private TestNGCucumberRunner testNGCucumberRunner;
@BeforeClass(alwaysRun = true)
public void setUpClass() throws Exception {
testNGCucumberRunner = new TestNGCucumberRunner(this.getClass());
}
@Test(groups = "cucumber", description = "Runs Cucumber Feature", dataProvider = "features")
public void feature(CucumberFeatureWrapper cucumberFeature) {
testNGCucumberRunner.runCucumber(cucumberFeature.getCucumberFeature());
}
@DataProvider
public Object features() {
return testNGCucumberRunner.provideFeatures();
}
@AfterClass(alwaysRun = true)
public void tearDownClass() throws Exception {
testNGCucumberRunner.finish();
}
}
And this is the TestNG xml suite:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="BDX Executive Summary Advertising Performance" parallel="tests" thread-count="20" preserve-order="true">
<listeners>
<listener class-name="common.testcases.TestCaseListener" />
<listener class-name="common.testcases.CaptureScreenshotOnFailureListenerBDX"/>
</listeners>
<test name="01: Check Advertising Performance Section Data">
<classes>
<class name="bdxReport.biExecutiveSummary.AdvertisingPerformance.Data.TestRunnerAdvertisingSectionData" />
</classes>
</test>
<test name="02: Check Advertising Performance Section Content">
<classes>
<class name="bdxReport.biExecutiveSummary.AdvertisingPerformance.Content.TestRunnerAdvertisingSectionContent" />
</classes>
</test>
</suite>
We have done a lot of research on what could be causing this behavior but until now we haven't been able to determine whats causing this behavior
java maven selenium testng cucumber-java
add a comment |
Whenever we run our test suite in parallel as "tests" with the TestNG xml file, it opens both instances of a chrome driver, but intermediately executes both cucumber features in the same window of chrome.
Gives us some result like this:
Searches two times in the search bar
This are Maven dependencies we have:
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm-deps</artifactId>
<version>1.0.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-testng</artifactId>
<version>1.2.5</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
We use a test runner for each test. All test runners are basically the same. Here is a test runner used:
package bdxReport.biAdsDashboard.AdvertisingPerformance.Content;
import cucumber.api.CucumberOptions;
import org.testng.annotations.Test;
@CucumberOptions(
features = "src/test/resources/FeaturesAdsDashboard/FeaturesAdvertisingPerformance/Content/CheckContentAdvertisingByProduct.feature",
glue = {"stepDefinitions"},
format = {
"pretty",
"html:target/cucumber-reports/AdsDashboard/TestRunnerCheckContentAdvertisingByProduct-Reports",
"json:target/cucumber-reports/AdsDashboard/TestRunnerCheckContentAdvertisingByProductReport.json",
"rerun:target/cucumber-reports/AdsDashboard/TestRunnerCheckContentAdvertisingByProduct-Reports/rerun.txt"
})
@Test
public class TestRunnerCheckContentAdvertisingByProduct {
private TestNGCucumberRunner testNGCucumberRunner;
@BeforeClass(alwaysRun = true)
public void setUpClass() throws Exception {
testNGCucumberRunner = new TestNGCucumberRunner(this.getClass());
}
@Test(groups = "cucumber", description = "Runs Cucumber Feature", dataProvider = "features")
public void feature(CucumberFeatureWrapper cucumberFeature) {
testNGCucumberRunner.runCucumber(cucumberFeature.getCucumberFeature());
}
@DataProvider
public Object features() {
return testNGCucumberRunner.provideFeatures();
}
@AfterClass(alwaysRun = true)
public void tearDownClass() throws Exception {
testNGCucumberRunner.finish();
}
}
And this is the TestNG xml suite:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="BDX Executive Summary Advertising Performance" parallel="tests" thread-count="20" preserve-order="true">
<listeners>
<listener class-name="common.testcases.TestCaseListener" />
<listener class-name="common.testcases.CaptureScreenshotOnFailureListenerBDX"/>
</listeners>
<test name="01: Check Advertising Performance Section Data">
<classes>
<class name="bdxReport.biExecutiveSummary.AdvertisingPerformance.Data.TestRunnerAdvertisingSectionData" />
</classes>
</test>
<test name="02: Check Advertising Performance Section Content">
<classes>
<class name="bdxReport.biExecutiveSummary.AdvertisingPerformance.Content.TestRunnerAdvertisingSectionContent" />
</classes>
</test>
</suite>
We have done a lot of research on what could be causing this behavior but until now we haven't been able to determine whats causing this behavior
java maven selenium testng cucumber-java
add a comment |
Whenever we run our test suite in parallel as "tests" with the TestNG xml file, it opens both instances of a chrome driver, but intermediately executes both cucumber features in the same window of chrome.
Gives us some result like this:
Searches two times in the search bar
This are Maven dependencies we have:
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm-deps</artifactId>
<version>1.0.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-testng</artifactId>
<version>1.2.5</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
We use a test runner for each test. All test runners are basically the same. Here is a test runner used:
package bdxReport.biAdsDashboard.AdvertisingPerformance.Content;
import cucumber.api.CucumberOptions;
import org.testng.annotations.Test;
@CucumberOptions(
features = "src/test/resources/FeaturesAdsDashboard/FeaturesAdvertisingPerformance/Content/CheckContentAdvertisingByProduct.feature",
glue = {"stepDefinitions"},
format = {
"pretty",
"html:target/cucumber-reports/AdsDashboard/TestRunnerCheckContentAdvertisingByProduct-Reports",
"json:target/cucumber-reports/AdsDashboard/TestRunnerCheckContentAdvertisingByProductReport.json",
"rerun:target/cucumber-reports/AdsDashboard/TestRunnerCheckContentAdvertisingByProduct-Reports/rerun.txt"
})
@Test
public class TestRunnerCheckContentAdvertisingByProduct {
private TestNGCucumberRunner testNGCucumberRunner;
@BeforeClass(alwaysRun = true)
public void setUpClass() throws Exception {
testNGCucumberRunner = new TestNGCucumberRunner(this.getClass());
}
@Test(groups = "cucumber", description = "Runs Cucumber Feature", dataProvider = "features")
public void feature(CucumberFeatureWrapper cucumberFeature) {
testNGCucumberRunner.runCucumber(cucumberFeature.getCucumberFeature());
}
@DataProvider
public Object features() {
return testNGCucumberRunner.provideFeatures();
}
@AfterClass(alwaysRun = true)
public void tearDownClass() throws Exception {
testNGCucumberRunner.finish();
}
}
And this is the TestNG xml suite:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="BDX Executive Summary Advertising Performance" parallel="tests" thread-count="20" preserve-order="true">
<listeners>
<listener class-name="common.testcases.TestCaseListener" />
<listener class-name="common.testcases.CaptureScreenshotOnFailureListenerBDX"/>
</listeners>
<test name="01: Check Advertising Performance Section Data">
<classes>
<class name="bdxReport.biExecutiveSummary.AdvertisingPerformance.Data.TestRunnerAdvertisingSectionData" />
</classes>
</test>
<test name="02: Check Advertising Performance Section Content">
<classes>
<class name="bdxReport.biExecutiveSummary.AdvertisingPerformance.Content.TestRunnerAdvertisingSectionContent" />
</classes>
</test>
</suite>
We have done a lot of research on what could be causing this behavior but until now we haven't been able to determine whats causing this behavior
java maven selenium testng cucumber-java
Whenever we run our test suite in parallel as "tests" with the TestNG xml file, it opens both instances of a chrome driver, but intermediately executes both cucumber features in the same window of chrome.
Gives us some result like this:
Searches two times in the search bar
This are Maven dependencies we have:
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm-deps</artifactId>
<version>1.0.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-testng</artifactId>
<version>1.2.5</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
We use a test runner for each test. All test runners are basically the same. Here is a test runner used:
package bdxReport.biAdsDashboard.AdvertisingPerformance.Content;
import cucumber.api.CucumberOptions;
import org.testng.annotations.Test;
@CucumberOptions(
features = "src/test/resources/FeaturesAdsDashboard/FeaturesAdvertisingPerformance/Content/CheckContentAdvertisingByProduct.feature",
glue = {"stepDefinitions"},
format = {
"pretty",
"html:target/cucumber-reports/AdsDashboard/TestRunnerCheckContentAdvertisingByProduct-Reports",
"json:target/cucumber-reports/AdsDashboard/TestRunnerCheckContentAdvertisingByProductReport.json",
"rerun:target/cucumber-reports/AdsDashboard/TestRunnerCheckContentAdvertisingByProduct-Reports/rerun.txt"
})
@Test
public class TestRunnerCheckContentAdvertisingByProduct {
private TestNGCucumberRunner testNGCucumberRunner;
@BeforeClass(alwaysRun = true)
public void setUpClass() throws Exception {
testNGCucumberRunner = new TestNGCucumberRunner(this.getClass());
}
@Test(groups = "cucumber", description = "Runs Cucumber Feature", dataProvider = "features")
public void feature(CucumberFeatureWrapper cucumberFeature) {
testNGCucumberRunner.runCucumber(cucumberFeature.getCucumberFeature());
}
@DataProvider
public Object features() {
return testNGCucumberRunner.provideFeatures();
}
@AfterClass(alwaysRun = true)
public void tearDownClass() throws Exception {
testNGCucumberRunner.finish();
}
}
And this is the TestNG xml suite:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="BDX Executive Summary Advertising Performance" parallel="tests" thread-count="20" preserve-order="true">
<listeners>
<listener class-name="common.testcases.TestCaseListener" />
<listener class-name="common.testcases.CaptureScreenshotOnFailureListenerBDX"/>
</listeners>
<test name="01: Check Advertising Performance Section Data">
<classes>
<class name="bdxReport.biExecutiveSummary.AdvertisingPerformance.Data.TestRunnerAdvertisingSectionData" />
</classes>
</test>
<test name="02: Check Advertising Performance Section Content">
<classes>
<class name="bdxReport.biExecutiveSummary.AdvertisingPerformance.Content.TestRunnerAdvertisingSectionContent" />
</classes>
</test>
</suite>
We have done a lot of research on what could be causing this behavior but until now we haven't been able to determine whats causing this behavior
java maven selenium testng cucumber-java
java maven selenium testng cucumber-java
asked Jan 2 at 13:59
NanococoNanococo
33
33
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Creating a separate runner file for every feature does not make sense to me. Have you tried "cucumber-jvm-parallel-plugin" to run the features. Please check following answer:
How to execute cucumber feature file parallel
Further, as per my experience this is the issue with the driver you are instantiating either it is static or it is not being managed properly. Firstly, try above link, in the meantime let me implement parallel execution in a fresh automation framework and I will paste the code here
Thanks. I think the issue was that we were using the static driver and session handling was getting mixed up. But we managed to get it back running
– Nanococo
Jan 4 at 15:12
Awesome.. Good to hear this 😊👍🏻.. Happy coding
– Dexterous Sikh
Jan 4 at 15:14
add a comment |
To take maximum advantage of TestNG you should use Testng's QAF framework. It supports multiple bdd syntax including gherkin using GherkinFactory.
QAF considers each scenario as TestNG test and Scenario Outline as TestNG data-driven test. As qaf provides driver management and resource management in-built, you don't need to write single line of code for driver management or resource management. All you need to do is create TestNG xml configuration file as per your requirement either to run parallel methods (scenarios) or groups or xml test on one or more browser.
Below example will run scenarios in parallel.
<test name="Gherkin-QAF-Test" parallel="methods">
<parameter name="step.provider.pkg" value="com.qmetry.qaf.automation.impl.step.qaf" />
<parameter name="scenario.file.loc" value="resources/features" />
<classes>
<class name="com.qmetry.qaf.automation.step.client.gherkin.GherkinScenarioFactory" />
</classes>
</test>
It enables different possible configuration combinations. Here is another example where it will run scenarios in two browsers and in parallel. You can configure number of threads for each browser as standard TestNG xml configuration.
<suite name="AUT Test Automation" verbose="0" parallel="tests">
<test name="Test-on-chrome" parallel="methods">
<parameter name="step.provider.pkg" value="com.qmetry.qaf.automation.impl.step.qaf" />
<parameter name="scenario.file.loc" value="resources/features" />
<parameter name="driver.name" value="chromeDriver" />
<classes>
<class name="com.qmetry.qaf.automation.step.client.gherkin.GherkinScenarioFactory" />
</classes>
</test>
<test name="Test FF" parallel="methods">
<parameter name="step.provider.pkg" value="com.qmetry.qaf.automation.impl.step.qaf" />
<parameter name="scenario.file.loc" value="resources/features" />
<parameter name="driver.name" value="firefoxDriver" />
<classes>
<class name="com.qmetry.qaf.automation.step.client.gherkin.GherkinScenarioFactory" />
</classes>
</test>
</suite>
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54007657%2ftestngcucumber-parallel-tests-run-on-same-chrome-instance%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Creating a separate runner file for every feature does not make sense to me. Have you tried "cucumber-jvm-parallel-plugin" to run the features. Please check following answer:
How to execute cucumber feature file parallel
Further, as per my experience this is the issue with the driver you are instantiating either it is static or it is not being managed properly. Firstly, try above link, in the meantime let me implement parallel execution in a fresh automation framework and I will paste the code here
Thanks. I think the issue was that we were using the static driver and session handling was getting mixed up. But we managed to get it back running
– Nanococo
Jan 4 at 15:12
Awesome.. Good to hear this 😊👍🏻.. Happy coding
– Dexterous Sikh
Jan 4 at 15:14
add a comment |
Creating a separate runner file for every feature does not make sense to me. Have you tried "cucumber-jvm-parallel-plugin" to run the features. Please check following answer:
How to execute cucumber feature file parallel
Further, as per my experience this is the issue with the driver you are instantiating either it is static or it is not being managed properly. Firstly, try above link, in the meantime let me implement parallel execution in a fresh automation framework and I will paste the code here
Thanks. I think the issue was that we were using the static driver and session handling was getting mixed up. But we managed to get it back running
– Nanococo
Jan 4 at 15:12
Awesome.. Good to hear this 😊👍🏻.. Happy coding
– Dexterous Sikh
Jan 4 at 15:14
add a comment |
Creating a separate runner file for every feature does not make sense to me. Have you tried "cucumber-jvm-parallel-plugin" to run the features. Please check following answer:
How to execute cucumber feature file parallel
Further, as per my experience this is the issue with the driver you are instantiating either it is static or it is not being managed properly. Firstly, try above link, in the meantime let me implement parallel execution in a fresh automation framework and I will paste the code here
Creating a separate runner file for every feature does not make sense to me. Have you tried "cucumber-jvm-parallel-plugin" to run the features. Please check following answer:
How to execute cucumber feature file parallel
Further, as per my experience this is the issue with the driver you are instantiating either it is static or it is not being managed properly. Firstly, try above link, in the meantime let me implement parallel execution in a fresh automation framework and I will paste the code here
answered Jan 3 at 0:48
Dexterous SikhDexterous Sikh
513
513
Thanks. I think the issue was that we were using the static driver and session handling was getting mixed up. But we managed to get it back running
– Nanococo
Jan 4 at 15:12
Awesome.. Good to hear this 😊👍🏻.. Happy coding
– Dexterous Sikh
Jan 4 at 15:14
add a comment |
Thanks. I think the issue was that we were using the static driver and session handling was getting mixed up. But we managed to get it back running
– Nanococo
Jan 4 at 15:12
Awesome.. Good to hear this 😊👍🏻.. Happy coding
– Dexterous Sikh
Jan 4 at 15:14
Thanks. I think the issue was that we were using the static driver and session handling was getting mixed up. But we managed to get it back running
– Nanococo
Jan 4 at 15:12
Thanks. I think the issue was that we were using the static driver and session handling was getting mixed up. But we managed to get it back running
– Nanococo
Jan 4 at 15:12
Awesome.. Good to hear this 😊👍🏻.. Happy coding
– Dexterous Sikh
Jan 4 at 15:14
Awesome.. Good to hear this 😊👍🏻.. Happy coding
– Dexterous Sikh
Jan 4 at 15:14
add a comment |
To take maximum advantage of TestNG you should use Testng's QAF framework. It supports multiple bdd syntax including gherkin using GherkinFactory.
QAF considers each scenario as TestNG test and Scenario Outline as TestNG data-driven test. As qaf provides driver management and resource management in-built, you don't need to write single line of code for driver management or resource management. All you need to do is create TestNG xml configuration file as per your requirement either to run parallel methods (scenarios) or groups or xml test on one or more browser.
Below example will run scenarios in parallel.
<test name="Gherkin-QAF-Test" parallel="methods">
<parameter name="step.provider.pkg" value="com.qmetry.qaf.automation.impl.step.qaf" />
<parameter name="scenario.file.loc" value="resources/features" />
<classes>
<class name="com.qmetry.qaf.automation.step.client.gherkin.GherkinScenarioFactory" />
</classes>
</test>
It enables different possible configuration combinations. Here is another example where it will run scenarios in two browsers and in parallel. You can configure number of threads for each browser as standard TestNG xml configuration.
<suite name="AUT Test Automation" verbose="0" parallel="tests">
<test name="Test-on-chrome" parallel="methods">
<parameter name="step.provider.pkg" value="com.qmetry.qaf.automation.impl.step.qaf" />
<parameter name="scenario.file.loc" value="resources/features" />
<parameter name="driver.name" value="chromeDriver" />
<classes>
<class name="com.qmetry.qaf.automation.step.client.gherkin.GherkinScenarioFactory" />
</classes>
</test>
<test name="Test FF" parallel="methods">
<parameter name="step.provider.pkg" value="com.qmetry.qaf.automation.impl.step.qaf" />
<parameter name="scenario.file.loc" value="resources/features" />
<parameter name="driver.name" value="firefoxDriver" />
<classes>
<class name="com.qmetry.qaf.automation.step.client.gherkin.GherkinScenarioFactory" />
</classes>
</test>
</suite>
add a comment |
To take maximum advantage of TestNG you should use Testng's QAF framework. It supports multiple bdd syntax including gherkin using GherkinFactory.
QAF considers each scenario as TestNG test and Scenario Outline as TestNG data-driven test. As qaf provides driver management and resource management in-built, you don't need to write single line of code for driver management or resource management. All you need to do is create TestNG xml configuration file as per your requirement either to run parallel methods (scenarios) or groups or xml test on one or more browser.
Below example will run scenarios in parallel.
<test name="Gherkin-QAF-Test" parallel="methods">
<parameter name="step.provider.pkg" value="com.qmetry.qaf.automation.impl.step.qaf" />
<parameter name="scenario.file.loc" value="resources/features" />
<classes>
<class name="com.qmetry.qaf.automation.step.client.gherkin.GherkinScenarioFactory" />
</classes>
</test>
It enables different possible configuration combinations. Here is another example where it will run scenarios in two browsers and in parallel. You can configure number of threads for each browser as standard TestNG xml configuration.
<suite name="AUT Test Automation" verbose="0" parallel="tests">
<test name="Test-on-chrome" parallel="methods">
<parameter name="step.provider.pkg" value="com.qmetry.qaf.automation.impl.step.qaf" />
<parameter name="scenario.file.loc" value="resources/features" />
<parameter name="driver.name" value="chromeDriver" />
<classes>
<class name="com.qmetry.qaf.automation.step.client.gherkin.GherkinScenarioFactory" />
</classes>
</test>
<test name="Test FF" parallel="methods">
<parameter name="step.provider.pkg" value="com.qmetry.qaf.automation.impl.step.qaf" />
<parameter name="scenario.file.loc" value="resources/features" />
<parameter name="driver.name" value="firefoxDriver" />
<classes>
<class name="com.qmetry.qaf.automation.step.client.gherkin.GherkinScenarioFactory" />
</classes>
</test>
</suite>
add a comment |
To take maximum advantage of TestNG you should use Testng's QAF framework. It supports multiple bdd syntax including gherkin using GherkinFactory.
QAF considers each scenario as TestNG test and Scenario Outline as TestNG data-driven test. As qaf provides driver management and resource management in-built, you don't need to write single line of code for driver management or resource management. All you need to do is create TestNG xml configuration file as per your requirement either to run parallel methods (scenarios) or groups or xml test on one or more browser.
Below example will run scenarios in parallel.
<test name="Gherkin-QAF-Test" parallel="methods">
<parameter name="step.provider.pkg" value="com.qmetry.qaf.automation.impl.step.qaf" />
<parameter name="scenario.file.loc" value="resources/features" />
<classes>
<class name="com.qmetry.qaf.automation.step.client.gherkin.GherkinScenarioFactory" />
</classes>
</test>
It enables different possible configuration combinations. Here is another example where it will run scenarios in two browsers and in parallel. You can configure number of threads for each browser as standard TestNG xml configuration.
<suite name="AUT Test Automation" verbose="0" parallel="tests">
<test name="Test-on-chrome" parallel="methods">
<parameter name="step.provider.pkg" value="com.qmetry.qaf.automation.impl.step.qaf" />
<parameter name="scenario.file.loc" value="resources/features" />
<parameter name="driver.name" value="chromeDriver" />
<classes>
<class name="com.qmetry.qaf.automation.step.client.gherkin.GherkinScenarioFactory" />
</classes>
</test>
<test name="Test FF" parallel="methods">
<parameter name="step.provider.pkg" value="com.qmetry.qaf.automation.impl.step.qaf" />
<parameter name="scenario.file.loc" value="resources/features" />
<parameter name="driver.name" value="firefoxDriver" />
<classes>
<class name="com.qmetry.qaf.automation.step.client.gherkin.GherkinScenarioFactory" />
</classes>
</test>
</suite>
To take maximum advantage of TestNG you should use Testng's QAF framework. It supports multiple bdd syntax including gherkin using GherkinFactory.
QAF considers each scenario as TestNG test and Scenario Outline as TestNG data-driven test. As qaf provides driver management and resource management in-built, you don't need to write single line of code for driver management or resource management. All you need to do is create TestNG xml configuration file as per your requirement either to run parallel methods (scenarios) or groups or xml test on one or more browser.
Below example will run scenarios in parallel.
<test name="Gherkin-QAF-Test" parallel="methods">
<parameter name="step.provider.pkg" value="com.qmetry.qaf.automation.impl.step.qaf" />
<parameter name="scenario.file.loc" value="resources/features" />
<classes>
<class name="com.qmetry.qaf.automation.step.client.gherkin.GherkinScenarioFactory" />
</classes>
</test>
It enables different possible configuration combinations. Here is another example where it will run scenarios in two browsers and in parallel. You can configure number of threads for each browser as standard TestNG xml configuration.
<suite name="AUT Test Automation" verbose="0" parallel="tests">
<test name="Test-on-chrome" parallel="methods">
<parameter name="step.provider.pkg" value="com.qmetry.qaf.automation.impl.step.qaf" />
<parameter name="scenario.file.loc" value="resources/features" />
<parameter name="driver.name" value="chromeDriver" />
<classes>
<class name="com.qmetry.qaf.automation.step.client.gherkin.GherkinScenarioFactory" />
</classes>
</test>
<test name="Test FF" parallel="methods">
<parameter name="step.provider.pkg" value="com.qmetry.qaf.automation.impl.step.qaf" />
<parameter name="scenario.file.loc" value="resources/features" />
<parameter name="driver.name" value="firefoxDriver" />
<classes>
<class name="com.qmetry.qaf.automation.step.client.gherkin.GherkinScenarioFactory" />
</classes>
</test>
</suite>
answered Jan 3 at 21:05
user861594user861594
3,03632034
3,03632034
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54007657%2ftestngcucumber-parallel-tests-run-on-same-chrome-instance%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown