title: TestNG+Cucumber parallel tests run on same chrome instance
body: <p>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.</p>
  
  <p>Gives us some result like this: 
  <a href="https://i.stack.imgur.com/TbK5c.png" rel="nofollow noreferrer">Searches two times in the search bar</a></p>
  
  <p>This are Maven dependencies we have:</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;info.cukes&lt;/groupId&gt;
      &lt;artifactId&gt;cucumber-java&lt;/artifactId&gt;
      &lt;version&gt;1.2.5&lt;/version&gt;
      &lt;scope&gt;test&lt;/scope&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;info.cukes&lt;/groupId&gt;
      &lt;artifactId&gt;cucumber-jvm-deps&lt;/artifactId&gt;
      &lt;version&gt;1.0.5&lt;/version&gt;
      &lt;scope&gt;test&lt;/scope&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;info.cukes&lt;/groupId&gt;
      &lt;artifactId&gt;cucumber-testng&lt;/artifactId&gt;
      &lt;version&gt;1.2.5&lt;/version&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
      &lt;exclusions&gt;
          &lt;exclusion&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
          &lt;/exclusion&gt;
      &lt;/exclusions&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>We use a test runner for each test. All test runners are basically the same. Here is a test runner used:</p>
  
  <pre><code>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();
      }
  }
  </code></pre>
  
  <p>And this is the TestNG xml suite: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" &gt;
  &lt;suite name="BDX Executive Summary Advertising Performance" parallel="tests" thread-count="20" preserve-order="true"&gt;
      &lt;listeners&gt;
          &lt;listener class-name="common.testcases.TestCaseListener" /&gt;
          &lt;listener class-name="common.testcases.CaptureScreenshotOnFailureListenerBDX"/&gt;
      &lt;/listeners&gt;
      &lt;test name="01: Check Advertising Performance Section Data"&gt;
          &lt;classes&gt;
              &lt;class name="bdxReport.biExecutiveSummary.AdvertisingPerformance.Data.TestRunnerAdvertisingSectionData" /&gt;
          &lt;/classes&gt;
      &lt;/test&gt;
      &lt;test name="02: Check Advertising Performance Section Content"&gt;
          &lt;classes&gt;
              &lt;class name="bdxReport.biExecutiveSummary.AdvertisingPerformance.Content.TestRunnerAdvertisingSectionContent" /&gt;
          &lt;/classes&gt;
      &lt;/test&gt;
  &lt;/suite&gt;
  </code></pre>
  
  <p>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 </p>