Loadrunner关联函数web_reg_save_param和web_reg_save_param_ex的区别

这两个web_reg_save_param和web_reg_save_param_ex的区别就是后者在左右边界中可以使用正则表达式/RE。

web_reg_save_param_ex的LB和LR参数可以采用以下限定符:

/ IC - 不区分大小写。即使边界值的情况与缓冲区中的字符串中的情况不同,边界也匹配。
/ BIN - 值是转义的二进制代码。请参阅输入二进制代码。

在版本11.00中,支持/ RE限定符。此支持已停止,因为更完整的正则表达式功能现在由web_reg_save_param_regexp提供。

示例1:正则表达式的运用示例

lr_save_string( "LL111 Value1 111RR\r\n" 
    "LL222 Value2 222RR\r\n" 
    "LL333 Value3 333RR\r\n" 
    "LL444 Value4 444RR\r\n", 
    "inParam" ); 
web_reg_save_param_ex( 
    "paramName=ex_example0", 
    "LB/RE=LL111",        
    "RB/RE=222RR",         
    LAST); 
web_reg_save_param_ex( 
    "paramName=ex_example1", 
    "LB/RE=LL[0-9]*",    // "LL" followed by zero or more symbols in range [0-9] 
    "RB/RE=.RR",        // Any symbol followed by "RR" 
    LAST); 
web_reg_save_param_ex( 
    "paramName=ex_example2", 
    "LB/RE=LL[0-9]+",    // "LL" followed by at least one symbol in range [0-9] 
    "RB/RE=.2RR",        // Any symbol followed by "2RR" 
    LAST); 
web_reg_save_param_ex( 
    "paramName=ex_example3", 
    "LB/RE=LL(33)+",    // "LL" followed by at least one instance of string "33" 
    "RB/RE=[3a]RR",        // Exactly one symbol ('3' or 'a') followed by "RR" 
    LAST); 
web_reg_save_param_ex( 
    "paramName=ex_example4", 
    // "LL" or "123" folowed by at least one instance 
    // of string containing symbols [4-9] and space 
    "LB/RE=((LL)|(123))[4-9 ]+", 
    // At least one instance of string containing symbols [4-9] 
    // and space followed by "RR" 
    "RB/RE=[4-9 ]+RR", 
    LAST); 

示例2:基本运用示例

int iRetVal = LR_PASS; 
lr_save_string( "HTTP%2F1%2E1%20301%20Moved%20Permanently%0A%0D" 
"Content%2DType%3A%20text%2Fhtml%0A%0D" 
"Date%3A%20Sun%2C%2014%20Feb%202010%2011%3A15%3A34%20GMT%0A%0D" 
"%0A%0D" 
"aaLLb%20bLLc%20%2E%2ecRRddRReeRRffLLggsadfsdfsdfRRhhRRiiLLj%20%2d%2DjRRkkLLmmLLnnRRoooRRpppLLqqq%0A%0D", 
    "inParam" ); 
iRetVal = web_reg_save_param_ex( 
    "ParamName=newParam", 
    "LB/IC=ll", 
    "RB/BIN/RE=RR", 
    "Ordinal=all", 
    "SaveLen=-1", 
    "DFEs=UrlEncoding", 
    SEARCH_FILTERS, 
        "Scope=body", 
LAST); 
lr_output_message("Return value = %d (%s).", iRetVal, iRetVal == LR_PASS ? "LR_PASS" : "LR_FAIL" ); 
web_submit_data("echo.asp_2", 
    "Action=http://localhost/cgi-bin/echo.asp", 
    "Method=POST", 
    "TargetFrame=", 
    "RecContentType=text/html", 
    "Referer=http://localhost/cgi_examples/echo_asp.html", 
    "Snapshot=t4.inf", 
    "Mode=HTML", 
    ITEMDATA, 
        "Name=code", "Value={inParam}", ENDITEM, 
    LAST); 


  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值