Want to take urls one by one at @BeforeClass
method and perform action in different @Test
methods.
But @dataProvider
only can used along with @Test
method not with @BeforeClass
in TestNG
constraint:-
Actually, All
@Test
method are independent on each other and So cant use single test method.urls in
@dataProvider
is always be changing. We gets urls in run-time
How could we manage such scenarios ?
In short architecture of framework:-
@BeforeClass(dataProvider = "getTestUrls")
public void testPage(){
driver.get(testUrls);
}
@Test(priority=1)
@Test(priority=2)
@DataProvider
public Object [][] getTestUrls(){
return new Object[][] { { 1,"http://www.yahoo.com" }, {2,"http://www.google.com" } };
}