LR四:返回json数组的GET接口
1 Action() 2 { 3 4 web_reg_find("Search=Body", 5 "SaveCount=find_cnt", 6 "Text=code\":\"0\"", 7 LAST); 10 lr_start_transaction("post_s"); 11 12 web_url("get_json", 13 14 "URL=http://localhost:8080/pinter/com/userList?genderType=0", 17 LAST ); 18 22 if(atoi(lr_eval_string("{find_cnt}")) > 0){ 23 24 lr_end_transaction("post_s", LR_PASS); 28 }else{ 29 lr_end_transaction("post_s", LR_FAIL); 30 31 32 } 36 return 0; 37 }
1 Virtual User Script started at : 2019-03-16 17:38:52 2 Starting action vuser_init. 3 Web Turbo Replay of LoadRunner 11.0.0 for WINXP; build 8859 (Aug 18 2010 20:14:31) [MsgId: MMSG-27143] 4 Run Mode: HTML [MsgId: MMSG-26000] 5 Run-Time Settings file: "C:\test_huzhenyu\Script\get_js\\default.cfg" [MsgId: MMSG-27141] 6 Ending action vuser_init. 7 Running Vuser... 8 Starting iteration 1. 9 Starting action Action. 10 Action.c(4): Registering web_reg_find was successful [MsgId: MMSG-26390] 11 Action.c(10): Notify: Transaction "post_s" started. 12 Action.c(12): t=626ms: 128-byte response headers for "http://localhost:8080/pinter/com/userList?genderType=0" (RelFrameId=1, Internal ID=1) 13 Action.c(12): HTTP/1.1 200 \r\n 14 Action.c(12): Content-Type: application/json;charset=UTF-8\r\n 15 Action.c(12): Transfer-Encoding: chunked\r\n 16 Action.c(12): Date: Sat, 16 Mar 2019 09:38:52 GMT\r\n 17 Action.c(12): \r\n 18 Action.c(12): t=671ms: 5-byte chunked response overhead for "http://localhost:8080/pinter/com/userList?genderType=0" (RelFrameId=1, Internal ID=1) 19 Action.c(12): c77\r\n 20 Action.c(12): t=681ms: 2-byte chunked response overhead for "http://localhost:8080/pinter/com/userList?genderType=0" (RelFrameId=1, Internal ID=1) 21 Action.c(12): \r\n 22 Action.c(12): t=697ms: 3191-byte chunked response body for "http://localhost:8080/pinter/com/userList?genderType=0" (RelFrameId=1, Internal ID=1) 23 Action.c(12): {"code":"0","message":"success","data":[{"id":0,"userName":"鎬ц兘娴嬭瘯瀛﹀憳0","password 24 Action.c(12): ":null,"age":13,"gender":0,"phoneNum":"13788881392","email":"beihe@testfan.com","address": 25 Action.c(12): "鍖椾含甯傛槍骞冲尯绉戞槦瑗胯矾106鍙烽櫌锛堝浗椋庣編鍞愯姳鍥患鍚堟ゼ锛\x893鍙锋ゼ1111"," 26 Action.c(12): createTime":"2019-03-16T09:38:52.651+0000","updateTime":"2019-03-16T09:38:52.651+0000"},{" 27 Action.c(12): id":1,"userName":"鎬ц兘娴嬭瘯瀛﹀憳1","password":null,"age":88,"gender":0,"phoneNum":"137 28 Action.c(12): 88881590","email":"beihe@testfan.com","address":"鍖椾含甯傛槍骞冲尯绉戞槦瑗胯矾106鍙烽櫌锛 29 Action.c(12): 堝浗椋庣編鍞愯姳鍥患鍚堟ゼ锛\x893鍙锋ゼ1111","createTime":"2019-03-16T09:38:52.651+0000" 30 Action.c(12): ,"updateTime":"2019-03-16T09:38:52.651+0000"},{"id":2,"userName":"鎬ц兘娴嬭瘯瀛﹀憳2","pa 31 Action.c(12): ssword":null,"age":77,"gender":0,"phoneNum":"13788881279","email":"beihe@testfan.com","add 32 Action.c(12): ress":"鍖椾含甯傛槍骞冲尯绉戞槦瑗胯矾106鍙烽櫌锛堝浗椋庣編鍞愯姳鍥患鍚堟ゼ锛\x893鍙锋ゼ1 33 Action.c(12): 111","createTime":"2019-03-16T09:38:52.651+0000","updateTime":"2019-03-16T09:38:52.651+000 34 Action.c(12): 0"},{"id":3,"userName":"鎬ц兘娴嬭瘯瀛﹀憳3","password":null,"age":96,"gender":0,"phoneNum 35 Action.c(12): ":"13788881086","email":"beihe@testfan.com","address":"鍖椾含甯傛槍骞冲尯绉戞槦瑗胯矾106鍙 36 Action.c(12): 烽櫌锛堝浗椋庣編鍞愯姳鍥患鍚堟ゼ锛\x893鍙锋ゼ1111","createTime":"2019-03-16T09:38:52.651 37 Action.c(12): +0000","updateTime":"2019-03-16T09:38:52.651+0000"},{"id":4,"userName":"鎬ц兘娴嬭瘯瀛﹀憳 38 Action.c(12): 4","password":null,"age":53,"gender":0,"phoneNum":"13788881406","email":"beihe@testfan.com 39 Action.c(12): ","address":"鍖椾含甯傛槍骞冲尯绉戞槦瑗胯矾106鍙烽櫌锛堝浗椋庣編鍞愯姳鍥患鍚堟ゼ锛\x893鍙 40 Action.c(12): 锋ゼ1111","createTime":"2019-03-16T09:38:52.651+0000","updateTime":"2019-03-16T09:38:52.65 41 Action.c(12): 1+0000"},{"id":5,"userName":"鎬ц兘娴嬭瘯瀛﹀憳5","password":null,"age":50,"gender":0,"pho 42 Action.c(12): neNum":"13788881897","email":"beihe@testfan.com","address":"鍖椾含甯傛槍骞冲尯绉戞槦瑗胯矾 43 Action.c(12): 106鍙烽櫌锛堝浗椋庣編鍞愯姳鍥患鍚堟ゼ锛\x893鍙锋ゼ1111","createTime":"2019-03-16T09:38:5 44 Action.c(12): 2.651+0000","updateTime":"2019-03-16T09:38:52.651+0000"},{"id":6,"userName":"鎬ц兘娴嬭瘯瀛 45 Action.c(12): ﹀憳6","password":null,"age":55,"gender":0,"phoneNum":"13788881741","email":"beihe@testfan 46 Action.c(12): .com","address":"鍖椾含甯傛槍骞冲尯绉戞槦瑗胯矾106鍙烽櫌锛堝浗椋庣編鍞愯姳鍥患鍚堟ゼ锛\x89 47 Action.c(12): 3鍙锋ゼ1111","createTime":"2019-03-16T09:38:52.651+0000","updateTime":"2019-03-16T09:38:52 48 Action.c(12): .651+0000"},{"id":7,"userName":"鎬ц兘娴嬭瘯瀛﹀憳7","password":null,"age":56,"gender":0," 49 Action.c(12): phoneNum":"13788881564","email":"beihe@testfan.com","address":"鍖椾含甯傛槍骞冲尯绉戞槦瑗胯 50 Action.c(12): 矾106鍙烽櫌锛堝浗椋庣編鍞愯姳鍥患鍚堟ゼ锛\x893鍙锋ゼ1111","createTime":"2019-03-16T09:38 51 Action.c(12): :52.651+0000","updateTime":"2019-03-16T09:38:52.651+0000"},{"id":8,"userName":"鎬ц兘娴嬭瘯 52 Action.c(12): 瀛﹀憳8","password":null,"age":49,"gender":0,"phoneNum":"13788881408","email":"beihe@testf 53 Action.c(12): an.com","address":"鍖椾含甯傛槍骞冲尯绉戞槦瑗胯矾106鍙烽櫌锛堝浗椋庣編鍞愯姳鍥患鍚堟ゼ锛 54 Action.c(12): \x893鍙锋ゼ1111","createTime":"2019-03-16T09:38:52.651+0000","updateTime":"2019-03-16T09:3 55 Action.c(12): 8:52.651+0000"},{"id":9,"userName":"鎬ц兘娴嬭瘯瀛﹀憳9","password":null,"age":12,"gender" 56 Action.c(12): :0,"phoneNum":"13788881614","email":"beihe@testfan.com","address":"鍖椾含甯傛槍骞冲尯绉戞槦 57 Action.c(12): 瑗胯矾106鍙烽櫌锛堝浗椋庣編鍞愯姳鍥患鍚堟ゼ锛\x893鍙锋ゼ1111","createTime":"2019-03-16T0 58 Action.c(12): 9:38:52.651+0000","updateTime":"2019-03-16T09:38:52.651+0000"}]} 59 Action.c(12): HTML parsing not performed for Content-Type "application/json" ("ParseHtmlContentType" Run-Time Setting is "TEXT"). URL="http://localhost:8080/pinter/com/userList?genderType=0" [MsgId: MMSG-26548] 60 Action.c(12): t=1268ms: 5-byte chunked response overhead for "http://localhost:8080/pinter/com/userList?genderType=0" (RelFrameId=1, Internal ID=1) 61 Action.c(12): 0\r\n 62 Action.c(12): \r\n 63 Action.c(12): Registered web_reg_find successful for "Text=code":"0"" (count=1) [MsgId: MMSG-26364] 64 Action.c(12): Notify: Saving Parameter "find_cnt = 1". 65 Action.c(12): web_url("get_json") was successful, 3191 body bytes, 128 header bytes, 12 chunking overhead bytes [MsgId: MMSG-26385] 66 Action.c(22): Notify: Parameter Substitution: parameter "find_cnt" = "1" 67 Action.c(24): Notify: Transaction "post_s" ended with "Pass" status (Duration: 1.2613 Wasted Time: 0.4238). 68 Ending action Action. 69 Ending iteration 1. 70 Ending Vuser... 71 Starting action vuser_end. 72 Ending action vuser_end. 73 Vuser Terminated.