0

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;
    }
}
user2376425
  • 85
  • 1
  • 3
  • 12
  • Check this... http://stackoverflow.com/questions/3693626/how-to-run-test-methods-in-specific-order-in-junit4 – Sankumarsingh Aug 01 '13 at 10:05
  • Well, thanks i already tried with "@FixMethodOrder(MethodSorters.JVM)", but it works only in one class(say : first). When i extend the first class in second "FixMethodOrder" doesn't work – user2376425 Aug 01 '13 at 10:33

0 Answers0