LoadRunner关联的例子
作者:网络转载 发布时间:[ 2013/10/22 10:04:01 ] 推荐标签:
1、关联是获取服务器返回给客户端的动态数据(字符串),把该字符串保存在参数中,在后面的函数中调用
2、注意关联函数的位置
例子
Action()
{
web_reg_save_param("UserSession",
"LB=name=userSession value=",
"RB=>",
"Ord=1",
"Search=NoResource",
LAST);
web_url("WebTours",
"URL=http://127.0.0.1:1080/WebTours/",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
LAST);
web_submit_data("login.pl",
"Action=http://127.0.0.1:1080/WebTours/login.pl",
"Method=POST",
"TargetFrame=body",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/WebTours/nav.pl?in=home",
"Snapshot=t2.inf",
"Mode=HTML",
ITEMDATA,
"Name=userSession", "Value={UserSession}", ENDITEM,
"Name=username", "Value=xxx", ENDITEM,
"Name=password", "Value=xxx", ENDITEM,
"Name=JSFormSubmit", "Value=off", ENDITEM,
"Name=login.x", "Value=53", ENDITEM,
"Name=login.y", "Value=8", ENDITEM,
LAST);
return 0;
}
服务器响应的信息
<input type=hidden name=userSession value=110598.691130012fziiQcApVHfDtVDDpfcVAf>
运行的结果
Action.c(11): Notify: Saving Parameter "UserSession = 110598.555285541fziiQVDpViHfDtVDDptHQVcf".
Action.c(11): Found resource "http://127.0.0.1:1080/WebTours/images/mer_login.gif" in HTML "http://127.0.0.1:1080/WebTours/nav.pl?in=home" [MsgId: MMSG-26659]
Action.c(11): web_url("WebTours") was successful, 6445 body bytes, 1608 header bytes [MsgId: MMSG-26386]
Action.c(21): Notify: Parameter Substitution: parameter "UserSession" = "110598.555285541fziiQVDpViHfDtVDDptHQVcf"
相关推荐
更新发布
功能测试和接口测试的区别
2023/3/23 14:23:39如何写好测试用例文档
2023/3/22 16:17:39常用的选择回归测试的方式有哪些?
2022/6/14 16:14:27测试流程中需要重点把关几个过程?
2021/10/18 15:37:44性能测试的七种方法
2021/9/17 15:19:29全链路压测优化思路
2021/9/14 15:42:25性能测试流程浅谈
2021/5/28 17:25:47常见的APP性能测试指标
2021/5/8 17:01:11