here when i run the "second" class the methods order of execution is : a b c Though over here, the "a" and "b" methods are dependent on "c" method. So can anyone tell me how should i do that ?
Code :
public class first {
public static WebDriver driver;
@BeforeClass
public static void beforeClass()
{
System.setProperty("webdriver.chrome.driver", "E:/chromedriver.exe");
driver = new ChromeDriver();
}
@Test
public void c()throws Exception
{
driver.get("URL");
WebElement login = driver.findElement(By.xpath("my xpath");
login.findElement(By.id("username")).sendKeys("username");
login.findElement(By.id("password")).sendKeys("pwd");
driver.findElement(By.xpath("my xpath")).click();
}
}
Second Class :
public class second extends first
{
@Test
public void a() throws Exception
{
//My Code;
}
@Test
public void b() throws Exception
{
//My Code;
}
}