ここで「2番目」のクラスを実行すると、メソッドの実行順序は次のとおりです。 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;
}
}