【转】四种方法实现自动化的逻辑部分和数据处理独立性-3.2

上一篇 / 下一篇  2013-11-26 11:02:24 / 个人分类:自动化测试

测试方法如下:

packagecom.test.java;

 

importjava.io.File;

importjava.io.IOException;

 

importjxl.read.biff.BiffException;

 

importorg.openqa.selenium.WebDriver;

importorg.openqa.selenium.firefox.FirefoxDriver;

importorg.openqa.selenium.support.PageFactory;

importorg.testng.annotations.Test;

 

publicclasstestLogin2 {

//我的所有代码在此路径下D:\Eclipse Script\TestNG\src\com\test\java

// TestNGProject Nameabc.xls存放在TestNG文件夹下

   FilefileName=newFile("abc.xls");

   

   @Test

   publicvoidtestLogin()throwsBiffException, IOException

   {

   WebDriver driver=newFirefoxDriver();

 

   login m=PageFactory.initElements(driver, login.class);

//读取abc.xls问价的第二行的所有数据,将第一列的值作为登录邮箱的的用户名

//第二列的值作为登录邮箱的密码

   String[] list = ExcelReader.readExcel(fileName,1);

   m.login(driver,list[0],list[1]);

   }

}

 

abc.xml文件的内容为:

username

password

justForYourTesting

135135

 

注:原创作品 转载请注明出处。


TAG: 数据 独立

 

评分:0

我来说两句

Open Toolbar