loadrunner12.55:循环打印lr_json_get_values()查询到的数据

 

脚本实现:详见黄色高亮显示部分

	web_reg_save_param("queryResponseBody",
		"LB=",
		"RB=",
		"Search=Body",
		LAST);
	
	web_custom_request("queryScene", 
		"URL=http://10.248.57.226:9010/user-center/uap-app-scene/queryScene", 
		"Method=POST", 
		"Resource=0", 
		"RecContentType=application/json", 
		"Referer=http://10.248.57.226:9010/U-C/", 
		"Snapshot=t23.inf", 
		"Mode=HTML", 
		"EncType=application/json;charset=utf-8", 
		"Body={\"current\":1,\"size\":10,\"busiSceneId\":\"\",\"sceneName\":\"\"}", 
		LAST);
	
		// Create a Json object from a string.
    lr_eval_json("Buffer={queryResponseBody}",
                 "JsonObject=json_obj_1", LAST);
	    
	busiSceneIdnum=lr_json_get_values("JsonObject=json_obj_1",//获取响应体所有busiSceneId字段值,用于后面删除的参数化
                "ValueParam=JinKuList",
                "QueryString=$.data.tablesArr[*].busiSceneId",
                "SelectAll=Yes",
                 LAST);

	
	while(i<=busiSceneIdnum){
		lr_save_int(i,"index");
		contactIDLastL=lr_eval_string("{JinKuList_{index}}");
		lr_output_message("contactIDLast=%s",lr_eval_string(contactIDLastL));
	
		i=i+1;
	}

  执行日志:

Action.c(14): Notify: Saving Parameter "queryResponseBody = {"success":true,"data":{"current":1,"size":10,"pageSizes":[5,10,15,20,25],"total":7,"pageCount":0,"start":0,"end":0,"tablesArr":[{"busiSceneId":"2a7b9e57-29e2-4664-8c4e-aa1fc27a8913","sceneName":"test6","sceneDesc":"","sceneTypeId":1,"createBy":"user_1","createTime":"2021-05-21 17:16:50","updateBy":"user_1","updateTime":"2021-05-24 14:13:31","state":1},{"busiSceneId":"37185001-d097-4e07-858c-e5c3f287d39a","sceneName":"用户充值行为分析","sceneDesc":"全用户分析用户明细下载","sceneTypeId":2,"createBy":"user_1","createTime":"2021-01-21 16:18:53","updateBy":"","updateTime":"","state":1},{"busiSceneId":"68902768-c1ef-417d-8a96-68f9ee32944a","sceneName":"test7","sceneDesc":"","sceneTypeId":1,"createBy":"user_1","createTime":"2021-05-21 17:18:30","updateBy":"","updateTime":"","state":1},{"busiSceneId":"9a978c8d-f255-416e-adc7-b7307736e15f","sceneName":"test1","sceneDesc":"","sceneTypeId":1,"createBy":"user_1","createTime":"2021-05-21 16:42:27","updateBy":"","updateTime":"","state":1},{"busiSceneId":"c4033e76-8e91-412a-8029-ba311c415772","sceneName":"test3","sceneDesc":"","sceneTypeId":1,"createBy":"user_1","createTime":"2021-05-21 17:14:11","updateBy":"","updateTime":"","state":1},{"busiSceneId":"cb57bffb-afd1-4f68-a3a7-47e224d80603","sceneName":"test2","sceneDesc":"","sceneTypeId":1,"createBy":"user_1","createTime":"2021-05-21 16:51:00","updateBy":"","updateTime":"","state":1},{"busiSceneId":"d6c81dbb-3047-4266-8619-1971cf0450b2","sceneName":"业务线配置新增","sceneDesc":"业务线配置新增","sceneTypeId":3,"createBy":"user_1","createTime":"2021-03-05 10:28:00","updateBy":"","updateTime":"","state":1}]},"code":200,"message":"成功!"}".
Action.c(14): web_custom_request("queryScene") was successful, 1685 body bytes, 512 header bytes, 12 chunking overhead bytes  	[MsgId: MMSG-26385]
Action.c(27): Notify: Parameter Substitution: parameter "queryResponseBody" =  "{"success":true,"data":{"current":1,"size":10,"pageSizes":[5,10,15,20,25],"total":7,"pageCount":0,"start":0,"end":0,"tablesArr":[{"busiSceneId":"2a7b9e57-29e2-4664-8c4e-aa1fc27a8913","sceneName":"test6","sceneDesc":"","sceneTypeId":1,"createBy":"user_1","createTime":"2021-05-21 17:16:50","updateBy":"user_1","updateTime":"2021-05-24 14:13:31","state":1},{"busiSceneId":"37185001-d097-4e07-858c-e5c3f287d39a","sceneName":"用户充值行为分析","sceneDesc":"全用户分析用户明细下载","sceneTypeId":2,"createBy":"user_1","createTime":"2021-01-21 16:18:53","updateBy":"","updateTime":"","state":1},{"busiSceneId":"68902768-c1ef-417d-8a96-68f9ee32944a","sceneName":"test7","sceneDesc":"","sceneTypeId":1,"createBy":"user_1","createTime":"2021-05-21 17:18:30","updateBy":"","updateTime":"","state":1},{"busiSceneId":"9a978c8d-f255-416e-adc7-b7307736e15f","sceneName":"test1","sceneDesc":"","sceneTypeId":1,"createBy":"user_1","createTime":"2021-05-21 16:42:27","updateBy":"","updateTime":"","state":1},{"busiSceneId":"c4033e76-8e91-412a-8029-ba311c415772","sceneName":"test3","sceneDesc":"","sceneTypeId":1,"createBy":"user_1","createTime":"2021-05-21 17:14:11","updateBy":"","updateTime":"","state":1},{"busiSceneId":"cb57bffb-afd1-4f68-a3a7-47e224d80603","sceneName":"test2","sceneDesc":"","sceneTypeId":1,"createBy":"user_1","createTime":"2021-05-21 16:51:00","updateBy":"","updateTime":"","state":1},{"busiSceneId":"d6c81dbb-3047-4266-8619-1971cf0450b2","sceneName":"业务线配置新增","sceneDesc":"业务线配置新增","sceneTypeId":3,"createBy":"user_1","createTime":"2021-03-05 10:28:00","updateBy":"","updateTime":"","state":1}]},"code":200,"message":"成功!"}"
Action.c(27): lr_eval_json succeed
Action.c(30): Notify: Saving Parameter "JinKuList_1 = 2a7b9e57-29e2-4664-8c4e-aa1fc27a8913".
Action.c(30): Notify: Saving Parameter "JinKuList_2 = 37185001-d097-4e07-858c-e5c3f287d39a".
Action.c(30): Notify: Saving Parameter "JinKuList_3 = 68902768-c1ef-417d-8a96-68f9ee32944a".
Action.c(30): Notify: Saving Parameter "JinKuList_4 = 9a978c8d-f255-416e-adc7-b7307736e15f".
Action.c(30): Notify: Saving Parameter "JinKuList_5 = c4033e76-8e91-412a-8029-ba311c415772".
Action.c(30): Notify: Saving Parameter "JinKuList_6 = cb57bffb-afd1-4f68-a3a7-47e224d80603".
Action.c(30): Notify: Saving Parameter "JinKuList_7 = d6c81dbb-3047-4266-8619-1971cf0450b2".
Action.c(30): Notify: Saving Parameter "JinKuList_count = 7".
Action.c(30): lr_json_get_values succeed, 7 matches
Action.c(38): Notify: Saving Parameter "index = 1".
Action.c(39): Notify: Parameter Substitution: parameter "index" =  "1"
Action.c(40): Notify: Parameter Substitution: parameter "JinKuList_1" =  "2a7b9e57-29e2-4664-8c4e-aa1fc27a8913"
Action.c(40): contactIDLast=2a7b9e57-29e2-4664-8c4e-aa1fc27a8913
Action.c(38): Notify: Saving Parameter "index = 2".
Action.c(39): Notify: Parameter Substitution: parameter "index" =  "2"
Action.c(40): Notify: Parameter Substitution: parameter "JinKuList_2" =  "37185001-d097-4e07-858c-e5c3f287d39a"
Action.c(40): contactIDLast=37185001-d097-4e07-858c-e5c3f287d39a
Action.c(38): Notify: Saving Parameter "index = 3".
Action.c(39): Notify: Parameter Substitution: parameter "index" =  "3"
Action.c(40): Notify: Parameter Substitution: parameter "JinKuList_3" =  "68902768-c1ef-417d-8a96-68f9ee32944a"
Action.c(40): contactIDLast=68902768-c1ef-417d-8a96-68f9ee32944a
Action.c(38): Notify: Saving Parameter "index = 4".
Action.c(39): Notify: Parameter Substitution: parameter "index" =  "4"
Action.c(40): Notify: Parameter Substitution: parameter "JinKuList_4" =  "9a978c8d-f255-416e-adc7-b7307736e15f"
Action.c(40): contactIDLast=9a978c8d-f255-416e-adc7-b7307736e15f
Action.c(38): Notify: Saving Parameter "index = 5".
Action.c(39): Notify: Parameter Substitution: parameter "index" =  "5"
Action.c(40): Notify: Parameter Substitution: parameter "JinKuList_5" =  "c4033e76-8e91-412a-8029-ba311c415772"
Action.c(40): contactIDLast=c4033e76-8e91-412a-8029-ba311c415772
Action.c(38): Notify: Saving Parameter "index = 6".
Action.c(39): Notify: Parameter Substitution: parameter "index" =  "6"
Action.c(40): Notify: Parameter Substitution: parameter "JinKuList_6" =  "cb57bffb-afd1-4f68-a3a7-47e224d80603"
Action.c(40): contactIDLast=cb57bffb-afd1-4f68-a3a7-47e224d80603
Action.c(38): Notify: Saving Parameter "index = 7".
Action.c(39): Notify: Parameter Substitution: parameter "index" =  "7"
Action.c(40): Notify: Parameter Substitution: parameter "JinKuList_7" =  "d6c81dbb-3047-4266-8619-1971cf0450b2"
Action.c(40): contactIDLast=d6c81dbb-3047-4266-8619-1971cf0450b2

  

 

loadrunner12.55:循环打印lr_json_get_values()查询到的数据

上一篇:netty实战 第一章


下一篇:html meta标签