int i;
int k=0;
String [] datalist=new String[20];
String content;
String filename=vars.get("test_data");
String str=vars.get("rownum");
int row = Integer.parseInt(str);
InputStream openfile = new FileInputStream(filename);
Workbook wb = Workbook.getWorkbook(openfile);
Sheet FirstSheet = wb.getSheet(0);
for(i=1;i<9;i++){ //9 是因为我表格就是 9 列的
if (i!=5&&i!=6){ //表格中白色的两行不取
Cell oCell= FirstSheet.getCell(i,row);
content=oCell.getContents();
datalist[k]=content;
k++;
}
}
vars.put("load",datalist[0]); //标识
vars.put("testcase",datalist[1]); //用例名称
vars.put("inter",datalist[2]); //接口
vars.put("method",datalist[3]); //请求方法
vars.put("request",datalist[4]); //请求数据
vars.put("response",datalist[5]); ///断言校验
return content;
这段代码执行报错
Response code: 500
Response message: org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval Sourced file: inline evaluation of: ``import java.awt.List; import java.io.FileInputStream; import java.io.FileNotFoun . . . '' : Typed variable declaration : Method Invocation Integer.parseInt