这是我的脚本代码。我正在尝试从 excel 表中提取数据,但是在读取 xlxs filenull 时出现错误提示异常
public class TC003_VerifyLoginWithDifferentRecords extends testbase {
public static final Logger log =
Logger.getLogger(TC003_VerifyLoginWithDifferentRecords.class.getName());
HomePage homepage;
@DataProvider(name = "logindata")
public String[][] getTestData()
{
String[][]testRecords = getData("TestData.xlsx","LoginTestData");
return testRecords;
}
@BeforeClass
public void setUp()
{
init();
}
@Test(dataProvider = "logindata")
public void TestLogin(String emailAddress, String Password)
{
log.info("================Starting VerifyLogin with Different
Records===================");
homepage = new HomePage(driver);
homepage.loginApplication(emailAddress,Password);
log.info("================Ending VerifyLogin with Different Records===================");
}
@AfterTest
public void endTest()
{
// driver.close();
}
这是 mt testbase 类,我在其中提供了 excel 表的路径
public String[][] getData(String workbookname, String sheetname)
{
String path = "H:/JAVA TESTING CODES/UIAutomation/src/main/java/com/test/automation/UIAutomation/data"+workbookname;
excel = new ExcelReader(path);
String[][] data = excel.getDataFromSheet(workbookname, sheetname);
return data;
}