1 package test.thread; 2 3 import org.testng.Assert; 4 import org.testng.TestNG; 5 import org.testng.annotations.Test; 6 7 import test.SimpleBaseTest; 8 9 public class DataProviderThreadPoolSizeTest extends SimpleBaseTest { 10 11 @Test shouldUseDefaultDataProviderThreadCount()12 public void shouldUseDefaultDataProviderThreadCount() { 13 TestNG tng = create(DataProviderThreadPoolSizeSampleTest.class); 14 tng.setGroups("parallel"); 15 tng.run(); 16 Assert.assertEquals(DataProviderThreadPoolSizeSampleTest.getThreadCount(), 10); 17 } 18 19 @Test shouldNotUseThreadsIfNotUsingParallel()20 public void shouldNotUseThreadsIfNotUsingParallel() { 21 TestNG tng = create(DataProviderThreadPoolSizeSampleTest.class); 22 tng.setGroups("sequential"); 23 tng.run(); 24 Assert.assertEquals(DataProviderThreadPoolSizeSampleTest.getThreadCount(), 1); 25 } 26 27 @Test shouldUseSpecifiedDataProviderThreadCount()28 public void shouldUseSpecifiedDataProviderThreadCount() { 29 TestNG tng = create(DataProviderThreadPoolSizeSampleTest.class); 30 tng.setGroups("parallel"); 31 tng.setDataProviderThreadCount(3); 32 tng.run(); 33 Assert.assertEquals(DataProviderThreadPoolSizeSampleTest.getThreadCount(), 3); 34 } 35 } 36