I am attempting to read xmls stored in one column of an Excel spreadsheet and fire them to a server using HTTP Sampler and then store the response xml in the same Excel. This is the structure of my test plan in JMeter:
However I have encountered and error. I am not able to pinpoint the exact place where the error is taking place but I have obtained the error message from the Results Tree are as follows:
for the JSR223 Sampler
Response message: javax.script.ScriptException: Sourced file: inline evaluation of:
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.us . . . '' : Typed variable declaration : Attempt to resolve method: parseInt() on undefined variable or class name: INTEGER : at Line: 6 : in file: inline evaluation of:
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.us . . . '' : INTEGER .parseInt ( vars .get ( "counter" ) ) in inline evaluation of: ``import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.us . . . '' at line number 6
The error in the HTTP Request Sampler's Response Data tab reads as:
Exception occured: Parsing xml error, xml string is:${RQI}
BeanShell Assertion error is :
Assertion error: true Assertion failure: false Assertion failure message: org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval In file: inline evaluation of: ``import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.us . . . '' Encountered ":" at line 6, column 65.
This is the code that I had used in the JSSR223 Sampler in the While Controller:
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFRow;
import java.io.*;
int i = INTEGER.parseInt(vars.get("counter"));
XSSFRow row = vars.getObject("book").getSheetAt(0).getRow(i);
vars.putObject("row", row);
for (int j = 1; j <= vars.getObject("book").getSheetAt(0).getRow(0).getLastCellNum(); j++) {
if (row.getCell(j) == null) {
row.createCell(j).setCellValue("");
}
}
String payload = row.getCell(1).toString();
vars.put("RQI",payload);
//String password = row.getCell(2).toString();
// vars.put("password",password);
//String expectedResult = row.getCell(5).toString();
// vars.put("expectedResult",expectedResult);
Please assist. Also, feel free to ask for more information as I have left out the code for the other JSR223 Samplers in this post for brevity. Thank you in advance.
INTEGER
? Do you mean Integer? Java class names are case sensitive. – Axel RichterAttempt to resolve method: parseInt() on undefined variable or class name: INTEGER
. – Axel Richter