关联函数的位置 自我总结

关联函数的位置 自我总结
关联函数目前只用到了两种形式

1、  web_reg_save_param("usersession","LB=<input type=hidden name=userSession value=","RB=>",LAST);
2、  web_reg_save_param("usersession","LB=<input type=hidden name=userSession value=","RB=>",“ORD=ALL”,”Savelen=18“,LAST);

其中usersession是loadrunner的参数名或者参数数组名。

LB是动态返回值的左边界
RB是动态返回值的右边界
ORD=ALL是选择所有相同左右边界的字符串都存入参数或者参数数组中
Savelen=18是要存储的字符串的长度
LAST表述函数结合苏位置

一般关联函数都是放到出现动态返回参数的录制响应函数之上,第一个非资源和脚本的响应之前,就可可以了

例如:

    web_url("home.html", 
        "URL=http://127.0.0.1:1080/WebTours/home.html", 
        "Resource=0", 
        "RecContentType=text/html", 
        "Referer=http://127.0.0.1:1080/WebTours/welcome.pl?signOff=true", 
        "Snapshot=t6.inf", 
        "Mode=HTTP", 
        LAST);
    web_reg_save_param("usersession","LB=<input type=hidden name=userSession value=","RB=>",LAST);
//这个位置就是出现动态参数之前,第一个非资源和脚本响应的位置
//web_url("nav.pl"))之下有一个js脚本和若干个图片类资源
    web_url("nav.pl", 
        "URL=http://127.0.0.1:1080/WebTours/nav.pl?in=home", 
        "Resource=0", 
        "RecContentType=text/html", 
        "Referer=http://127.0.0.1:1080/WebTours/welcome.pl?signOff=true", 
        "Snapshot=t7.inf", 
        "Mode=HTTP", 
        LAST);

    web_concurrent_end(NULL);

    web_concurrent_start(NULL);

    web_url("JSFormSubmit.js", 
        "URL=http://127.0.0.1:1080/WebTours/JSFormSubmit.js", 
        "Resource=1", 
        "RecContentType=application/x-javascript", 
        "Referer=http://127.0.0.1:1080/WebTours/nav.pl?in=home", 
        "Snapshot=t8.inf", 
        LAST);

    web_url("mer_login.gif", 
        "URL=http://127.0.0.1:1080/WebTours/images/mer_login.gif", 
        "Resource=1", 
        "RecContentType=image/gif", 
        "Referer=http://127.0.0.1:1080/WebTours/nav.pl?in=home", 
        "Snapshot=t9.inf", 
        LAST);

    web_concurrent_end(NULL);


    lr_start_transaction("login-0");

    lr_think_time(17);
    web_submit_data("login.pl", 
        "Action=http://127.0.0.1:1080/WebTours/login.pl", 
        "Method=POST", 
        "RecContentType=text/html", 
        "Referer=http://127.0.0.1:1080/WebTours/nav.pl?in=home", 
        "Snapshot=t10.inf", 
        "Mode=HTTP", 
        ITEMDATA, 
        "Name=userSession", "Value={usersession}", ENDITEM, 
        "Name=username", "Value=test001", ENDITEM, 
        "Name=password", "Value=123456", ENDITEM, 
        "Name=JSFormSubmit", "Value=on", ENDITEM, 
        "Name=login.x", "Value=53", ENDITEM, 
        "Name=login.y", "Value=12", ENDITEM, 
        LAST);

你可能感兴趣的:(Web,函数,loadrunner)