I have a test method belonging to multiple groups, I want to ensure that one @BeforeGroups method (setupHomePage) runs before another (setupUniversalSearchPage). The order must be defined within java only as I am supposed to use any testng xml. Although in similar case in another test class the order of execution is as desired.
public abstract class HomePageTest extends TestBase
{
@BeforeGroups("homePageTests")
public void setupHomePage()
{
loadHomePage();
}
}
public abstract class UniversalSearchPageTest extends HomePageTest
{
@BeforeGroups("universalPageTests")
public void setupUniversalSearchPage()
{
navigateToSearchPage();
}
}
public class UniversalSearchPageBasicTest extends UniversalPageTest
{
@Test(groups = {"homePageTests","universalPageTests")
public void searchVerificationTest()
{
//test code here
}
}
So far I have tried following : 1. reversing the order of groups in @Test annotation of searchVerificationTest 2. adding @Test(groups = "homePageTests") above declaration of UniversalSearchPageBasicTest class.
I would like to know how the order @BeforeGroups method is determined as it is different in one class than other. If it is of any relation I am using maven in eclipse and Appium I am new to testng , let me know if I am missing anything basic here