TestNg 所有测试都在跳过
TestNg all Tests are skipping
当我执行我的 Testng 代码时,测试总是被跳过。我收到以下错误
配置失败:@BeforeTest beforeTest
下面是我的代码片段
@Test(dataProvider = "bhaskar")
public void f(String xpath,String values,String action,String browser) {
if(browser.contentEquals("common")) {
switch(action) {
case "openurl" : openurl(values); break;
case "verifytitle": verifytitle(values); break;
case "click": click(xpath); break;
default: System.out.println("keyword not found");
}
}
}
//-------------------------------------
public void openurl(String values) {
driver.get(values);
}
public void verifytitle(String values) {
String title=driver.getTitle();
Assert.assertEquals(title, values);
}
public void click(String xpath){
driver.findElement(By.xpath(xpath)).click();
System.out.println("clicked");
}
@DataProvider(name="bhaskar")
public String[] dp() {
String[] a=new String[] {"","w3schools.com/","openurl","common" };
return a;
}
出于某种原因,TestNG 并不总是打印来自配置方法的未处理异常的堆栈跟踪(例如 @BeforeTest
)。尝试将配置方法中的代码包装在 try-catch 中并自行打印堆栈跟踪或尝试调试 and/or 将日志记录添加到配置方法中。
当我执行我的 Testng 代码时,测试总是被跳过。我收到以下错误
配置失败:@BeforeTest beforeTest
下面是我的代码片段
@Test(dataProvider = "bhaskar")
public void f(String xpath,String values,String action,String browser) {
if(browser.contentEquals("common")) {
switch(action) {
case "openurl" : openurl(values); break;
case "verifytitle": verifytitle(values); break;
case "click": click(xpath); break;
default: System.out.println("keyword not found");
}
}
}
//-------------------------------------
public void openurl(String values) {
driver.get(values);
}
public void verifytitle(String values) {
String title=driver.getTitle();
Assert.assertEquals(title, values);
}
public void click(String xpath){
driver.findElement(By.xpath(xpath)).click();
System.out.println("clicked");
}
@DataProvider(name="bhaskar")
public String[] dp() {
String[] a=new String[] {"","w3schools.com/","openurl","common" };
return a;
}
出于某种原因,TestNG 并不总是打印来自配置方法的未处理异常的堆栈跟踪(例如 @BeforeTest
)。尝试将配置方法中的代码包装在 try-catch 中并自行打印堆栈跟踪或尝试调试 and/or 将日志记录添加到配置方法中。