51Testing软件测试论坛
标题:
在一个类中定义了一个接口类,在测试类中实例化并调用该类的方法时报错,求指导
[打印本页]
作者:
alchaochao
时间:
2015-4-6 15:49
标题:
在一个类中定义了一个接口类,在测试类中实例化并调用该类的方法时报错,求指导
ExcelDataProvider类:
public class ExcelDataProvider implements Iterator<Object[]>
{
private Workbook book = null;
private Sheet sheet = null;
private int rowNum = 0;
private int currentRowNo = 0;
private int columnNum = 0;
private String[] columnnName;
public ExcelDataProvider(String classname, String methodname) {
try {
int dotNum = classname.indexOf(".");
if (dotNum > 0) {
classname = classname.substring(classname.lastIndexOf(".") + 1,
classname.length());
}
测试Login类:
public class Login {
public static void jd_login(String Erroruser, String ErrorPwd, String RightUser, String RightPwd, String AliasUser) throws InterruptedException {
// TODO Auto-generated method stub
String classname = "Login";
String methodname = "jd_login";
Iterator<Object[]> exceldata = new ExcelDataProvider();
exceldata.ExcelDataProvider(classname, methodname);
最后这句报错,提示The method ExcelDataProvider(String,String) is undefined for type Iterator<Object[]>,请问这里该怎么写?
作者:
ermine
时间:
2015-4-9 12:10
Iterator<Object[]> exceldata = new ExcelDataProvider();
这句,你强制转成Iterator了,所以调用不了ExcelDataProvider方法
改成
ExcelDataProvider exceldata = new ExcelDataProvider();
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2