loadrunner12自动关联后运行出错
用手机app record录制的脚本,在loadrunner12、5 home版本中运行正常运行,但是因为logintoken每次登陆后从返回中自动获取,就用loadrunner自动关联功能,脚本如下
web_reg_save_param_regexp(
"ParamName=login_token",
"RegExp=JSESSIONID=(.*?);",
SEARCH_FILTERS,
"Scope=Cookies",
"IgnoreRedirections=No",
LAST);
web_submit_data("login",
"Action=http://113.79.32.200/api/client/user/login",
"Method=POST",
"RecContentType=application/json",
"Referer=",
"Snapshot=t37.inf",
"Mode=HTML",
ITEMDATA,
"Name=userName", "Value=13600547138", ENDITEM,
"Name=device_id", "Value=c89e0241507011", ENDITEM,
"Name=login_token", "Value=", ENDITEM,
"Name=uuid", "Value=87062046-5a2f-31f3-b8a7-66bdab9a5552", ENDITEM,
"Name=passWord", "Value={PasswordParameter}", ENDITEM,
LAST);
web_submit_data("getMessage",
"Action=http://113.79.32.200/common/user/getMessage",
"Method=POST",
"RecContentType=application/json",
"Referer=",
"Snapshot=t38.inf",
"Mode=HTML",
ITEMDATA,
"Name=device_id", "Value=c89e0241507011", ENDITEM,
"Name=login_token", "Value={login_token}", ENDITEM,
"Name=uuid", "Value=87062046-5a2f-31f3-b8a7-66bdab9a5552", ENDITEM,
LAST);
但是系统执行的到最后的时候,提示未找到login_token,于是用fiddler录制了返回数据,看到返回结果中确实也是按如下格式返回的
HTTP/1.1 200 OK
Server: nginx/1.8.1
Date: Mon, 28 Mar 2016 06:35:35 GMT
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Set-Cookie: JSESSIONID=7D852C52A2ECDB7122E810DF503821FC; Path=/; HttpOnly
Content-Encoding: gzip
Vary: Accept-Encoding
我就想不明白为什么取不到JSESSIONID,特征码也没写错,如果是特征码有问题,系统自动关联之前,loadrunner自己的脚本可以取到login_token,也就是JSESSIONID的值。
困惑了好几天,请哪位高人指点一下,不甚感谢
后来把loadrunner的返回日志也打印出来,发现在返回包里没有JSESSIONID内容,看来自动关联不一定是对的,重新设置了正则表达式后,就能取到所需要的数据。
总结如下
fidller等录制工具的内容也只能做个参考,最好打开loadrunner返回日志开关,以loadrunner返回的内容为准。
页:
[1]