码迷,mamicode.com
首页 > 其他好文 > 详细

loadrunner 添加token关联

时间:2016-07-03 23:18:27      阅读:2940      评论:0      收藏:0      [点我收藏+]

标签:

1、token是服务器返回的一个值,

用于验证身份。

因此需要在response body中查找第一次出现token的地方。

2、token是登录时候返回的,因此需要在登录的请求那里找。

3、切换到树图,找到响应的登录操作

技术分享

3、添加关联之后,脚本中会增加一个语句,它出现在登录之前。

/Correlation comment - Do not change!Original value=48d5b44a89864d17b86509a201cc942c Name =CorrelationParameter_1
    web_reg_save_param_ex(
        "ParamName=CorrelationParameter_1",
        "LB=:\"",
        "RB=\",",
        SEARCH_FILTERS,
        "Scope=Body",
        "RequestUrl=*/authentication*",
        LAST);
    web_submit_data("authentication",
        "Action=http://www.moojnn.com/mojingcsp/authentication",
        "Method=POST",
        "TargetFrame=",
        "RecContentType=application/json",
        "Referer=http://www.moojnn.com/user/login.html",
        "Snapshot=t3.inf",
        "Mode=HTML",
        ITEMDATA,
        "Name=username", "Value={userName}", ENDITEM,
        "Name=password", "Value=e10adc3949ba59abbe56e057f20f883e", ENDITEM,
        EXTRARES,
        "URL=http://pro.moojnn.com/lib/leaflet/leaflet.css?_d=1467120445822", "Referer=http://pro.moojnn.com/projects.html", ENDITEM,
        "URL=http://pro.moojnn.com/css/icon/style.css?_d=1467120445822", "Referer=http://pro.moojnn.com/projects.html", ENDITEM,
        "URL=http://pro.moojnn.com/css/common.css?_d=1467120445822", "Referer=http://pro.moojnn.com/projects.html", ENDITEM,
        "URL=http://pro.moojnn.com/js/mjchart/theme/mjvi.css?_d=1467120445822", "Referer=http://pro.moojnn.com/projects.html", ENDITEM,
        "URL=http://pro.moojnn.com/js/config.js", "Referer=http://pro.moojnn.com/projects.html", ENDITEM,
        "URL=http://pro.moojnn.com/js/functions.js?_d=1467120445822", "Referer=http://pro.moojnn.com/projects.html", ENDITEM,
        "URL=http://pro.moojnn.com/js/mjchart/mjvi.min.js?_d=1467120445822", "Referer=http://pro.moojnn.com/projects.html", ENDITEM,
        "URL=http://pro.moojnn.com/js/common.js?_d=1467120445822", "Referer=http://pro.moojnn.com/projects.html", ENDITEM,
        "URL=../static/js/csp.js?_=1467473737411", "Referer=http://pro.moojnn.com/projects.html", ENDITEM,
        LAST);

    web_url("popup-help.html_2",
        "URL=http://www.moojnn.com/user/popup-help.html?from=http%3A%2F%2Fpro.moojnn.com%2Fprojects.html%23%2F%3FMoJing-Token%3D{CorrelationParameter_1}",
        "TargetFrame=",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=http://pro.moojnn.com/projects.html",
        "Snapshot=t4.inf",
        "Mode=HTML",
        EXTRARES,
        "URL=http://hm.baidu.com/hm.js?177ebef2f9a9244c738b903eef680a83", "Referer=http://pro.moojnn.com/projects.html", ENDITEM,
        "URL=http://z6.cnzz.com/stat.htm?id=1253524178&r=http%3A%2F%2Fwww.moojnn.com%2Fuser%2Flogin.html&lg=zh-cn&ntime=1467467462&cnzz_eid=1418985023-1467467462-http%3A%2F%2Fwww.moojnn.com%2F&showp=1366x768&p=http%3A%2F%2Fpro.moojnn.com%2Fprojects.html%23%2F%3FMoJing-Token%3D{CorrelationParameter_1}&t=&h=1&rnd=1141052232", "Referer=http://pro.moojnn.com/projects.html", ENDITEM,
        "URL=http://pro.moojnn.com/mojing-server/user/login?MoJing-Token={CorrelationParameter_1}", "Referer=http://pro.moojnn.com/projects.html", ENDITEM,
        "URL=http://hm.baidu.com/hm.gif?cc=0&ck=1&cl=24-bit&ds=1366x768&et=0&fl=22.0&ja=0&ln=zh-CN&lo=0&lt=1467473654&nv=0&rnd=1523982449&si=177ebef2f9a9244c738b903eef680a83&st=4&su=http%3A%2F%2Fwww.moojnn.com%2Fuser%2Flogin.html&v=1.1.26&lv=3", "Referer=http://pro.moojnn.com/projects.html", ENDITEM,
        LAST);

 

loadrunner 添加token关联

标签:

原文地址:http://www.cnblogs.com/amy7758/p/5639006.html

(1)
(1)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!