loadrunner怎么打印接口返回的参数

//首先使用web_reg_save_param方法保存服务器返回的参数,如下:
web_reg_save_param ("S_respond","LB=","RB=",LAST);
//调用接口
web_custom_request("query",
"URL=http://14.119.110.190/",
"Method=POST",
"TargetFrame=",
"RecContentType=text/html",
"Resource=0",
"Referer=",
"Mode=HTML",//HTML或者HTTP都可以
"Body={"
"\"version\":\"v1.0\"
"\"requestId\":\"{requestId}\"," "}", LAST); //第一种方法:直接打印服务器返回的字符串 lr_output_message(lr_eval_string("{S_respond}")); //第二种方法:对返回的字符串转码 lr_convert_string_encoding ( lr_eval_string ("{S_respond}"),LR_ENC_UTF8 ,NULL,"respond"); //打印转码后的响应报文 lr_output_message ( "%s",lr_eval_string ("{respond}"));

  编辑打印内容:

//编辑打印内容:
//\n\nusername is :%s == 换行换行+ username is:+输出类型;
lr_log_message("\n\nusername is :%s",lr_eval_string("{respond}"));

  假设,某以上接口服务器返回的报文为:

{"requestId":"0b5628f2326657017903190016","code":"SUCCESS","message":"操作成功","data":{}}

 

posted @ 2017-12-13 16:18  胖叔blog  阅读(5144)  评论(0编辑  收藏  举报