I need to execute all tests in the order for each dataprovider object. My try:
public class TestTest extends BaseTest {
private String creds;
@Factory(dataProvider = "creds")
TestTest(String creds){
this.creds = creds;
}
@DataProvider
public static Object[][] creds(){
return new Object[][]{
{"Creds1"},
{"Creds2"}
};
}
@Test()
public void test1(){
this.creds = creds;
Log.info("test1 creds: " + creds);
}
@Test(dependsOnMethods = "test1")
public void test2(){
Log.info("test2 creds: " + this.creds);
}
@Test(dependsOnMethods = "test2")
public void test3(){
Log.info("test3 creds: " + this.creds);
}
}
out:
> test1 creds: Creds2
> test1 creds: Creds1
> test2 creds: Creds2
> test2 creds: Creds1
> test3 creds: Creds2
> test3 creds: Creds1
But I need:
> test1 creds: Creds1
> test2 creds: Creds1
> test3 creds: Creds1
> test1 creds: Creds2
> test2 creds: Creds2
> test3 creds: Creds3
- The reason why I need to move in this way - I need to have a report in the allure for each test, but if I'll use one-Test-method-way, I'll get results only for first test