1 package test.dataprovider;
2 
3 import org.testng.ITestContext;
4 import org.testng.TestNG;
5 import org.testng.annotations.DataProvider;
6 import org.testng.annotations.Test;
7 
8 import test.SimpleBaseTest;
9 
10 /**
11  * Data providers were not working properly with parallel=true
12  * @author cbeust
13  */
14 public class ParallelDataProviderTest extends SimpleBaseTest {
15 //  protected static Logger logger = Logger
16 //    .getLogger(SampleMessageLoaderTest2.class);
17 //  // This method will provide data to any test method that declares that its
18   // Data Provider
19   // is named "test1"
20   @DataProvider(name = "test1", parallel = true)
createData1()21   public Object[][] createData1() {
22    return new Object[][] {
23      { "Cedric", 36},
24      { "Anne", 37},
25      { "A", 36},
26      { "B", 37}
27    };
28   }
29   // This test method declares that its data should be supplied by the Data
30   // Provider
31   // named "test1"
32   @Test(dataProvider = "test1", threadPoolSize = 5)
verifyData1(ITestContext testContext, String n1, Integer n2)33   public void verifyData1(ITestContext testContext, String n1, Integer n2) {
34   }
35 
36   @Test
shouldNotThrowConcurrentModificationException()37   public void shouldNotThrowConcurrentModificationException() {
38     TestNG tng = create(ParallelDataProvider2Test.class);
39     tng.run();
40   }
41 }
42