I have code in BeanShell PostProcessor like this,
import org.json.simple.JSONObject;
import org.json.simple.JSONArray;
import org.json.simple.parser.JSONParser;
import java.util.*;
String response = prev.getResponseDataAsString(); JSONParser parser = new JSONParser(); JSONArray GroupList = (JSONArray) parser.parse(response); JSONArray GroupIds = new JSONArray(); while (i.hasNext()) { JSONObject objGroup = (JSONObject) i.next(); GroupIds.push(i.next().get("id")); var.put("GroupIds",GroupIds); } log.info(GroupIds);
When I try to run test, it show error,
jmeter.util.BeanShellInterpreter: Error invoking bsh method: eval Sourced file: inline evaluation of: ``import org.json.simple.JSONObject; import org.json.simple.JSONArray; import org. . . . '' : Attempt to resolve method: hasNext() on undefined variable or class name: i
jmeter.extractor.BeanShellPostProcessor: Problem in BeanShell script org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval Sourced file: inline evaluation of: ``import org.json.simple.JSONObject; import org.json.simple.JSONArray; import org. . . . '' : Attempt to resolve method: hasNext() on undefined variable or class name: i
How can I correct this code ? thanks