loadrunner:HTTP接口脚本实例
1 Action() 2 { 3 4 5 lr_rendezvous("getAppHomeModulesList"); 6 7 lr_start_transaction("getAppHomeModulesList"); 8 9 /* 10 web_reg_save_param("appHomeModulesListResult", 11 "LB=code\":", 12 "RB=,\"msg", 13 LAST); 14 */ 15 16 web_add_header("Content-Type", "application/json"); 17 18 web_add_header("requestid", "8eaf210f-70bd-4730-aad8-32f03b61d5a8");//也可动态生成UUID 19 20 web_add_header("channelId", "android"); 21 22 web_add_header("usertype", "member"); 23 24 web_save_timestamp_param("tStamp", LAST); 25 26 web_add_header("timestamp", "{tStamp}"); 27 28 29 web_reg_find("Search=Body", 30 // "SaveCount=1", 31 "Text=\"code\":10000", 32 LAST); 33 34 web_custom_request("web_custom_request", 35 "URL=http://api.wf.com:8032/**/**/v1/appHomeModulesList", 36 "Method=POST", 37 "TargetFrame=", 38 "Resource=0", 39 "Referer=", 40 "Body={\"releasePlatform\":1,\"type\":0}", 41 LAST); 42 43 // lr_output_message(lr_eval_string("{appHomeModulesListResult}")); 44 45 46 lr_end_transaction("getAppHomeModulesList", LR_AUTO); 47 48 49 return 0; 50 }