在进行测试时,我因为测试之一被忽略而第二次失败而出错。已经发布了测试类和驱动程序管理器的类,并在执行测试后显示了错误。
这是我的考试班:
@BeforeSuite
public void setUp(){
driver = DriverManager.getWebDriver();
driver.get(Configuration.getInstance().getProperty("appUrl"));
}
@Test
public void testrequestDemo(){
topNavigation = new TopNavigation(driver);
page = topNavigation.clickRequestDemoLink();
page.KeyInEmail("Azhar@gmail.com")
.and().KeyinCompany("ABC");
}
DriverManager类:
public class DriverManager {
private WebDriver driver;
private static DriverManager manager;
private DriverManager(){
init();
driver = createDriver();
}
private void init(){
System.setProperty("webdriver.chrome.driver",
Configuration.getInstance().getProperty("chrome.executable"));
}
/**
* This method will create webdriver instance based on the
* property provided.
* @return
*/
private WebDriver createDriver(){
if(Configuration.getInstance().getProperty("browser").equals(Constants.CHROME)){
return new ChromeDriver();
}
else if(Configuration.getInstance().getProperty("browser").equals(Constants.FIREFOX)){
return new FirefoxDriver();
}else {
return new ChromeDriver();
}
}
private WebDriver getDriver() {
return driver;
}
public static WebDriver getWebDriver(){
if(manager==null){
manager = new DriverManager();
return manager.getDriver();
}
return manager.getDriver();
}
}
这是我得到的错误
- 对于setUP测试失败
- 对于testrequestDemo测试被忽略>
co.pragra.testingframework.drivermanager.DriverManager.createDriver(DriverManager.java:99) co.pragra.testingframework.drivermanager.DriverManager。(DriverManager.java:73) co.pragra.testingframework.drivermanager.DriverManager.getWebDriver(DriverManager.java:113) co.pragra.testingframework.testcases.HomePageTest.setUp(HomePageTest.java:37)