title: Cucumber ExtentReport generation with TestNG during multiple thread execution
body: <p>I'm running tests in parallel on mobile devices using Cucumber and TestNG. My TestNG runner class is given below.</p>
  
  <pre><code>@CucumberOptions(
          features="src/test/resources/features",
          glue={"org.cucumber.stepdefs"},
          plugin = {
          "com.cucumber.listener.ExtentCucumberFormatter:" }, monochrome = true)
  
  public class TestRunner extends BaseTest {
  
      private static TestNGCucumberRunner testRunner;
  
      @BeforeClass
      public void setUP() {   
          System.out.println("Thread = " + Thread.currentThread().getId() + " - object hash = " + this.hashCode());
          testRunner = new TestNGCucumberRunner(TestRunner.class);
          ExtentProperties extentProperties = ExtentProperties.INSTANCE;
          extentProperties.setReportPath("output/" + this.hashCode() + "-report.html");
      }
  
      @Test(description="Tests",dataProvider="features")
      public void setUpClass(CucumberFeatureWrapper cFeature) {
          testRunner.runCucumber(cFeature.getCucumberFeature());
      }
  
      @DataProvider(name="features")
      public Object[][] getFeatures() {
          return testRunner.provideFeatures();
      }
  
      @AfterClass
      public static void teardown() {
          testRunner.finish();
      }
  
  }
  </code></pre>
  
  <p>Which is working as expected - my Cucumber tests are run in parallel on separate threads for each connected device (defined in my testng.xml file). </p>
  
  <p>I'm using ExtentReports to generate reports after each run, though at the moment i'm getting only a single report, where I would like a separate report for each running thread.</p>
  
  <p>What I can't understand is why this is happening. I've added console prints to check if there is an instant of the TestRunner class for each running thread, and indeed there is - my console log after a run contains the following (assuming 2 mobile devices are connected):</p>
  
  <pre><code>Thread = 33 - object hash = 923219673
  Thread = 32 - object hash = 280884709
  </code></pre>
  
  <p>So this is working as i expect, except when it comes to generating the report, only 1 report containing all the test data is created. I was under the assumption that because i am setting the report path to a unique file name in each thread in the <code>setUp()</code> method that a report for each thread should be created? </p>
  
  <p>It seems that when it comes to generating the report that the Cucumber ExtendReport plugin waits for all tests to finish and generates a bulk report by default. Is this correct? And if so, how might i change this?</p>
  
  <p>Below is the main part of my <code>pom.xml</code> file for additional configuration information. </p>
  
  <pre><code>&lt;properties&gt;
        &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
     &lt;/properties&gt;
     &lt;dependencies&gt;
        &lt;!-- https://mvnrepository.com/artifact/info.cukes/cucumber-java --&gt;
        &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;/dependency&gt;
        &lt;!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-jvm --&gt;
        &lt;dependency&gt;
           &lt;groupId&gt;io.cucumber&lt;/groupId&gt;
           &lt;artifactId&gt;cucumber-jvm&lt;/artifactId&gt;
           &lt;version&gt;4.2.0&lt;/version&gt;
           &lt;type&gt;pom&lt;/type&gt;
        &lt;/dependency&gt;
        &lt;!-- https://mvnrepository.com/artifact/info.cukes/cucumber-testng --&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;/dependency&gt;
        &lt;!-- https://mvnrepository.com/artifact/info.cukes/cucumber-picocontainer --&gt;
        &lt;dependency&gt;
           &lt;groupId&gt;info.cukes&lt;/groupId&gt;
           &lt;artifactId&gt;cucumber-picocontainer&lt;/artifactId&gt;
           &lt;version&gt;1.2.5&lt;/version&gt;
           &lt;scope&gt;test&lt;/scope&gt;
        &lt;/dependency&gt;
        &lt;!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-server --&gt;
        &lt;dependency&gt;
           &lt;groupId&gt;org.seleniumhq.selenium&lt;/groupId&gt;
           &lt;artifactId&gt;selenium-server&lt;/artifactId&gt;
           &lt;version&gt;3.4.0&lt;/version&gt;
        &lt;/dependency&gt;
        &lt;!-- https://mvnrepository.com/artifact/org.testng/testng --&gt;
        &lt;dependency&gt;
           &lt;groupId&gt;org.testng&lt;/groupId&gt;
           &lt;artifactId&gt;testng&lt;/artifactId&gt;
           &lt;version&gt;6.11&lt;/version&gt;
        &lt;/dependency&gt;
        &lt;!-- https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager --&gt;
        &lt;dependency&gt;
           &lt;groupId&gt;io.github.bonigarcia&lt;/groupId&gt;
           &lt;artifactId&gt;webdrivermanager&lt;/artifactId&gt;
           &lt;version&gt;1.7.1&lt;/version&gt;
        &lt;/dependency&gt;
        &lt;!-- https://mvnrepository.com/artifact/com.aventstack/extentreports --&gt;
        &lt;dependency&gt;
           &lt;groupId&gt;com.aventstack&lt;/groupId&gt;
           &lt;artifactId&gt;extentreports&lt;/artifactId&gt;
           &lt;version&gt;3.1.5&lt;/version&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
           &lt;groupId&gt;com.vimalselvam&lt;/groupId&gt;
           &lt;artifactId&gt;cucumber-extentsreport&lt;/artifactId&gt;
           &lt;version&gt;3.0.1&lt;/version&gt;
        &lt;/dependency&gt;
        &lt;!-- https://mvnrepository.com/artifact/info.cukes/cucumber-junit --&gt;
        &lt;dependency&gt;
           &lt;groupId&gt;info.cukes&lt;/groupId&gt;
           &lt;artifactId&gt;cucumber-junit&lt;/artifactId&gt;
           &lt;version&gt;1.2.5&lt;/version&gt;
           &lt;scope&gt;test&lt;/scope&gt;
        &lt;/dependency&gt;
        &lt;!-- https://mvnrepository.com/artifact/io.appium/java-client --&gt;
        &lt;!-- https://mvnrepository.com/artifact/io.appium/java-client --&gt;
        &lt;dependency&gt;
           &lt;groupId&gt;io.appium&lt;/groupId&gt;
           &lt;artifactId&gt;java-client&lt;/artifactId&gt;
           &lt;version&gt;6.0.0-BETA3&lt;/version&gt;
        &lt;/dependency&gt;
     &lt;/dependencies&gt;
     &lt;build&gt;
        &lt;plugins&gt;
           &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;configuration&gt;
                 &lt;source&gt;1.8&lt;/source&gt;
                 &lt;target&gt;1.8&lt;/target&gt;
              &lt;/configuration&gt;
           &lt;/plugin&gt;
           &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.19&lt;/version&gt;
              &lt;configuration&gt;
                 &lt;parallel&gt;tests&lt;/parallel&gt;
                 &lt;threadCount&gt;10&lt;/threadCount&gt;
                 &lt;suiteXmlFiles&gt;
                    &lt;suiteXmlFile&gt;testng.xml&lt;/suiteXmlFile&gt;
                 &lt;/suiteXmlFiles&gt;
              &lt;/configuration&gt;
           &lt;/plugin&gt;
        &lt;/plugins&gt;
     &lt;/build&gt;
  </code></pre>