There's no problem with TestNG per se here.
The dataproviderthreadcount
attribute that you have set in your pom file is going to be applicable and relevant only when you are running your test via mvn clean test
.
If you are trying to run this test class from within the IDE (IntelliJ or Eclipse for that matter) its not going take affect.
Here's a test class that I created which is powered by a data provider ( For the sake of simplicity I have intentionally kept cucumber out of the equation )
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
public class AppTest {
@Test(dataProvider = "dp")
public void shouldAnswerWithTrue(int i) {
System.err.println("Running on [" + Thread.currentThread().getId() + "]");
}
@DataProvider(name = "dp", parallel = true)
public Object[][] testData() {
return new Object[][]{
{1},
{2},
{3},
{4},
{5},
{6}
};
}
}
Here's the command line output when I run mvn clean test
[INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) @ testng_playground ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.rationaleemotions.AppTest
Running on [15]
Running on [14]
Running on [15]
Running on [14]
Running on [14]
Running on [15]
[INFO] Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.62 s - in com.rationaleemotions.AppTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 6, Failures: 0, Errors: 0, Skipped: 0