从数据库取值和响应值做比较,使用beanshell如下:
import org.json.JSONArray; import org.json.JSONObject; res_str = prev.getResponseDataAsString(); JSONObject res_json_obj = new JSONObject(res_str); JSONArray dbd_json_array = new JSONArray("${dbd}"); // 数据库转json JSONObject dbd_json_obj = new JSONObject(); FailureMessage = ""; Failure = true; res_json_obj = new JSONObject(res_json_obj.get("data").toString()); if (!res_json_obj.isNull("list")) { JSONArray res_json_array = new JSONArray(res_json_obj.get("list").toString()); log.info("响应长度:" + res_json_array.length()); log.info("数据返回长度:" + dbd_json_array.length()); if (res_json_array.length() == dbd_json_array.length()) { for (in