Can we have something like this where
public class NewTest {
private List<String> id= new ArrayList<String>();
@Test
public void Test1() {
id.add("First Value");
id.add("Second Value");
id.add("Third Value");
id.add("Fourth Value");
System.out.println("Added all the data to the list");
}
@DataProvider
public Object[][] dp() {
Object[][] returnData= new String[1][];
for (int i=0; i<id.size();i++){
returnData[0][i]=id.get(i);
}
return returnData;
}
@Test(dataProvider = "dp", priority=1)
public void Test2(String s) {
System.out.println(s);
}
Output of Test2 could print all the values added in the List in Test1? I have a situation and I need to run test with parameters generated from another test. Kindly help.