我正在从 guru99.com 学习 TestNG 框架,当我添加一些代码并作为 TestNG 运行时,它显示的错误是空指针异常,这是我的代码。
public class DemoTestNG {
public String baseUrl = "http://www.newtours.demoaut.com/";
WebDriver driver = new FirefoxDriver();
@Test
public void verifyHomePageTitle() {
driver.get(baseUrl);
String expectedTitle = "Welcome: Mercury Tours";
String actualTitle = driver.getTitle();
AssertJUnit.assertEquals(actualTitle, expectedTitle);
driver.quit();
}
}