title: TestNG Parallel Test Configuration
body: <p>With TestNG on Java 6 here's what I'd like to do in my Maven project:</p>
  
  <ol>
  <li>Kick off a test method (<code>testAbc</code>) that can run multi-threaded using a queue-based <code>DataProvider</code></li>
  <li>Kick off a test that relies on <code>testAbc</code> (<code>testXyz</code>) after all the threads from <code>testAbc</code> complete</li>
  </ol>
  
  <p>I thought I had it configured properly, but I do not.</p>
  
  <p>Currently I have it configured as such:</p>
  
  <pre><code>@Test ( singleThreaded = false )
  public class AutomatedTest {
  
    @Test (
      alwaysRun = true,
      dataProviderClass = UseCaseProvider.class,
      dataProvider = "getUseCasesNoDependencies",
      skipFailedInvocations = false,
      threadPoolSize = 25
    )
    public void testAbc(UseCase useCase) {
      executeUseCase(useCase);
    }
  
    @Test (
      dependsOnMethods = {"testAbc"},
      dataProviderClass = UseCaseProvider.class,
      dataProvider = "getUseCasesDependencies",
      singleThreaded = true
    )
    public void testXyz(UseCase useCase) {
      executeUseCase(useCase);
    }
  }
  </code></pre>
  
  <p>All of the tests in <code>testAbc</code> that are provided by the <code>@DataProvider</code> take a long time to run but can be run up to 25 simultaneously (there's a good few hundred of them).  Everything in <code>testXyz</code> cannot be run in parallel as not only do all cases rely on <code>testAbc</code>, but the processing is just not friendly to thread pooling like that.</p>
  
  <p>My Maven configuration is setup as follows:</p>
  
  <pre><code>&lt;build&gt;
    &lt;plugins&gt;
      &lt;plugin&gt;
        &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
        &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
        &lt;configuration&gt;
          &lt;parallel&gt;methods&lt;/parallel&gt;
          &lt;threadCount&gt;25&lt;/threadCount&gt;
        &lt;/configuration&gt;
      &lt;/plugin&gt;
    &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p>When I run <code>mvn -U test</code> I don't see my tests actually running in parallel.
  Help!</p>
  
  <pre><code>$ mvn -version
  Apache Maven 2.2.1 (r801777; 2009-08-06 15:16:01-0400)
  Java version: 1.6.0_35
  Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
  Default locale: en_US, platform encoding: MacRoman
  OS name: "mac os x" version: "10.7.5" arch: "x86_64" Family: "mac"
  </code></pre>