title: How to run TestNG test several times with BeforeTest execution?
body: <p>I try to execute the test several times with DataProvider.
  All works fine, but <code>@BeforeTest</code> and <code>@AfterTest</code> execute only one time, but I need this execution with each iteration.:</p>
  <pre class="lang-java prettyprint-override"><code>public class TestClass{
  
      @BeforeTest
      public void before(){
          Log.info(&quot;BeforeTest&quot;);
      }
  
      @AfterTest
      public void after(){
          Log.info(&quot;AfterTest&quot;);
      }
  
      @DataProvider
      public Object[][] tenTime(){
          return new Object[][]{
                  {0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}
          };
      }
      
      private static Integer c = 0;
  
      @Test(dataProvider = &quot;tenTime&quot;)
      public void tenTimesTest(Integer count){
          Assert.assertSame(count, c++);
      }
  }
  </code></pre>
  <ul>
  <li><strong>Actual result:</strong><br/>
  <code>@BeforeTest</code> and <code>@AfterTest</code> executes once:</li>
  </ul>
  <pre><code>[INFO] 19-01-21 11:54:47 main | BeforeTest
  [INFO] 19-01-21 11:54:47 main | The tenTimesTest test started
  [INFO] 19-01-21 11:54:47 main | tenTimesTest test is starting.
  [INFO] 19-01-21 11:54:48 main | The tenTimesTest test succeed
  [INFO] 19-01-21 11:54:48 main | tenTimesTest test is passed
  [INFO] 19-01-21 11:54:48 main | The tenTimesTest test started
  [INFO] 19-01-21 11:54:48 main | tenTimesTest test is starting.
  [INFO] 19-01-21 11:54:48 main | The tenTimesTest test succeed
  [INFO] 19-01-21 11:54:48 main | tenTimesTest test is passed
  ..............
  [INFO] 19-01-21 11:54:50 main | AfterTest
  </code></pre>
  <ul>
  <li><strong>Expected result</strong><br/>
  <code>@BeforeTest</code> and <code>@AfterTest</code> executes each time with <code>tenTimesTest</code>:</li>
  </ul>
  <pre><code>[INFO] 19-01-21 11:54:47 main | BeforeTest
  [INFO] 19-01-21 11:54:47 main | The tenTimesTest test started
  [INFO] 19-01-21 11:54:47 main | tenTimesTest test is starting.
  [INFO] 19-01-21 11:54:48 main | The tenTimesTest test succeed
  [INFO] 19-01-21 11:54:48 main | tenTimesTest test is passed
  [INFO] 19-01-21 11:54:50 main | AfterTest
  [INFO] 19-01-21 11:54:47 main | BeforeTest
  [INFO] 19-01-21 11:54:47 main | The tenTimesTest test started
  [INFO] 19-01-21 11:54:47 main | tenTimesTest test is starting.
  [INFO] 19-01-21 11:54:48 main | The tenTimesTest test succeed
  [INFO] 19-01-21 11:54:48 main | tenTimesTest test is passed
  [INFO] 19-01-21 11:54:50 main | AfterTest
  </code></pre>