0
我正在嘗試使用beanshell後處理器讀取jmeter中的xls文件。我在日誌中得到的錯誤是:「類型變量聲明:類:名稱空間中找不到的工作簿」 以下是我的代碼。如何在jmeter中使用jxl
import java.io.*;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
FileInputStream(vars.get("jmeterScriptPath")+"\\"+vars.get("VIN")+".xls", true);
Workbook wb = Workbook.getWorkbook(new java.io.File("C:\\datasheet\\RIGUD000000000051.xls"));
Sheet sh = wb.getSheet("RIGUD000000000051");
// To get the number of rows present in sheet
int totalNoOfRows = sh.getRows();
// To get the number of columns present in sheet
int totalNoOfCols = sh.getColumns();
for (int row = 0; row < totalNoOfRows; row++) {
for (int col = 0; col < totalNoOfCols; col++) {
System.out.print(sh.getCell(col, row).getContents() + "\t");
vars.put("responseContent",sh.getCell(col, row).getContents());
}
System.out.println();
}