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