Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9107173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:30:35+00:00 2026-06-17T02:30:35+00:00

With TestNG on Java 6 here’s what I’d like to do in my Maven

  • 0

With TestNG on Java 6 here’s what I’d like to do in my Maven project:

  1. Kick off a test method (testAbc) that can run multi-threaded using a queue-based DataProvider
  2. Kick off a test that relies on testAbc (testXyz) after all the threads from testAbc complete

I thought I had it configured properly, but I do not.

Currently I have it configured as such:

@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);
  }
}

All of the tests in testAbc that are provided by the @DataProvider take a long time to run but can be run up to 25 simultaneously (there’s a good few hundred of them). Everything in testXyz cannot be run in parallel as not only do all cases rely on testAbc, but the processing is just not friendly to thread pooling like that.

My Maven configuration is setup as follows:

<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-plugin</artifactId>
      <configuration>
        <parallel>methods</parallel>
        <threadCount>25</threadCount>
      </configuration>
    </plugin>
  </plugins>
</build>

When I run mvn -U test I don’t see my tests actually running in parallel.
Help!

$ 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"
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T02:30:36+00:00Added an answer on June 17, 2026 at 2:30 am

    What about adding threadPoolSize

    @Test ( singleThreaded = false, threadPoolSize = 5 )
    public class AutomatedTest {
    ...
    

    The threadPoolSize attribute allows you to specify how many threads should be allocated for this execution.

    EDIT

    Just noticed that you missed invocationCount. Please note that threadPoolSize is ignored if invocationCount is not specified.

    So please try leaving class @Test as it is and update testAbc

      @Test (
        alwaysRun = true,
        dataProviderClass = UseCaseProvider.class,
        dataProvider = "getUseCasesNoDependencies",
        skipFailedInvocations = false,
        threadPoolSize = 25,
        invocationCount = 25
      )
      public void testAbc(UseCase useCase) {
        executeUseCase(useCase);
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having some trouble getting a test to run that uses TestNg's @DataProvider
Here is ported the JVM into one ARM board. When i run the Test.java
I have java 1.6, maven 2, activeMQ 5.5 and functional tests with testng. When
I am trying to run the EasyMock example given here with TestNG and am
I have the same problem as Junit4 and TestNG in one project with Maven
Multi-Test TestNG.xml file results in java.lang.NullPointerException Hello Quality Team, I need help getting TestNG
So here's my project: I am building a central interface/dashboard to present the test
I tried creating a test project with maven and the unit testing worked fine.
Here's where I wish Java's String class had a replaceLast method, bu it doesn't
Trying to run Java7 Hello World Project from command line with maven.. If I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.