1package test.dependent; 2 3import org.testng.annotations.DataProvider; 4import org.testng.annotations.Factory; 5import org.testng.annotations.Test; 6import org.testng.collections.Lists; 7 8import java.util.List; 9 10public class GroupByInstancesSampleTest { 11 private String m_country; 12 public static List<String> m_log = Lists.newArrayList(); 13 14 private static void log(String method, String country) { 15// System.out.println("LOG:" + method + "#" + country + " " + Thread.currentThread().getId()); 16 m_log.add(method + "#" + country); 17 } 18 19 @DataProvider 20 public Object[][] dp() { 21 return new Object[][] { 22 new Object[] { "usa" }, 23 new Object[] { "uk" }, 24 }; 25 } 26 27 @Factory(dataProvider = "dp") 28 public GroupByInstancesSampleTest(String country) { 29 m_country = country; 30 } 31 32 @Test 33 public void signIn() { 34 log("signIn", m_country); 35 } 36 37 @Test(dependsOnMethods = "signIn") 38 public void signOut() { 39 log("signOut", m_country); 40 } 41 42 @Override 43 public String toString() { 44 return "[GroupByInstancesSampleTest: " + m_country + "]"; 45 } 46} 47