Loadrunner中,lr_output_message()的变量使用
源代码:Action()
{
char * input;
char * rtn;
input="my input";
lr_output_message("the output is %s",input);
lr_output_message("the output is %s",lr_eval_string("{input}"));
web_reg_save_param("rtn",
"LB=<div class=\"result\">",
"RB=</div>",
LAST);
web_submit_data("searchAppList.do_2",
"Action=http://192.168.1.244:11080/189store/searchAppList.do",
"Method=POST",
"RecContentType=text/html",
"Referer=http://192.168.1.244:11080/189store/web/Test/searchPanel.html",
"Snapshot=t67.inf",
"Mode=HTTP",
ITEMDATA,
"Name=type", "Value=list", ENDITEM,
"Name=content", "Value=天翼", ENDITEM,
LAST);
lr_output_message("输出结果rnt=%s", rtn);
lr_output_message("输出结果rnt=%s", lr_eval_string("{rtn}"));
return 0;
}
运行结果:
Action.c(6): the output is my input
Action.c(7): the output is {input}
Action.c(9): Registering web_reg_save_param was successful
Action.c(14): web_submit_data("searchAppList.do_2") was successful, 1938 body bytes, 242 header bytes
Action.c(26): 输出结果rnt=(null)
Action.c(27): 输出结果rnt=
瀵逛笉璧凤紝鏈悳绱㈠埌"<span style="color:red;">锟斤拷锟斤拷</span>"鐩稿叧搴旂敤
分析:
对于自定义的变量,如果直接赋值,就直接使用变量名称;如果使用了web_reg_save_param,就使用 lr_eval_string("{rtn}")。 这是参数和变量的问题。。 web_reg_save_param获取到的是参数
而 char * input来的是变量,在使用和输出的时候还是有点小区别的
页:
[1]