首页 » 技术分享 » LoadRunner函数详解之web_reg_save_param_ex

LoadRunner函数详解之web_reg_save_param_ex

 

定义:将请求的动态数据信息保存到一个参数
函数形式:web_reg_save_param_ex( const char *ParamName, [const char *LB, ][const char *RB,] , ,LAST );
这里写图片描述

示例1:基本运用示例

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); 

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

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); 

转载自原文链接, 如需删除请联系管理员。

原文链接:LoadRunner函数详解之web_reg_save_param_ex,转载请注明来源!

0