0

在这里,当我运行“第二个”类时,方法的执行顺序是:a b c 虽然在这里,“a”和“b”方法依赖于“c”方法。那么谁能告诉我该怎么做?

代码 :

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();
   }
}

二等:

public class second extends first
{
@Test
public void a() throws Exception
{
        //My Code;
    }

@Test
public void b() throws Exception
{
        //My Code;
    }
}
4

0 回答 0