• LoadRunner中存储表格参数------关联数组


    主要用到

    web_reg_save_param_ex函数("Scope=All",),

    sprintf( CProdNo,"{CProdNo_%d}",i );

     函数功能:把格式化的数据写入某个字符串

    //脚本如下:

    Action()
    {
    // -----------------参数化
    int i,count;
    
    char CProdNo[30] ={''}; 
    char CAppNo[30] ={''}; 
    char CPlyNo[30] ={''}; 
    char TCrtTm[30] ={''};
    
    web_set_max_html_param_len("1024");
    
     
    
    lr_start_transaction("车险查询");
    
    
    //Correlation comment - Do not change!Original value='1993301033020170000158' Name ='CPlyNo'
    web_reg_save_param_ex(
    "ParamName=CPlyNo",
    "LB="CPlyNo" value="",
    "RB=" newValue",
    "Ordinal=All",
    SEARCH_FILTERS,
    "Scope=All",
    "RequestUrl=*/actionservice.ai*",
    LAST);
    
    //Correlation comment - Do not change!Original value='5993301033020170000158' Name ='CAppNo'
    web_reg_save_param_ex(
    "ParamName=CAppNo",
    "LB="CAppNo" value="",
    "RB=" newValue",
    "Ordinal=All",
    SEARCH_FILTERS,
    "Scope=All",
    "RequestUrl=*/actionservice.ai*",
    LAST);
    
    //Correlation comment - Do not change!Original value='{CProdNo}' Name ='CProdNo'
    web_reg_save_param_ex(
    "ParamName=CProdNo",
    "LB="CProdNo" value="",
    "RB=" newValue",
    "Ordinal=All",
    SEARCH_FILTERS,
    "Scope=All",
    "RequestUrl=*/actionservice.ai*",
    LAST);
    
    //Correlation comment - Do not change!Original value='{TCrtTm}' Name ='TCrtTm'
    web_reg_save_param_ex(
    "ParamName=TCrtTm",
    "LB="TCrtTm" value="",
    "RB=" newValue",
    "Ordinal=All",
    SEARCH_FILTERS,
    "Scope=All",
    "RequestUrl=*/actionservice.ai*",
    LAST);
    
    web_custom_request("actionservice.ai_3",
    "URL=http://{UrlAddress}/vch/actionservice.ai",
    "Method=POST",
    "TargetFrame=",
    "Resource=1",
    "Referer=http://{UrlAddress}/vch/core/jsp/vch/print/vchplyedr.jsp?CASOPDPT=33&random=1490176345906",
    "Snapshot=t79.inf",
    "Body=---",
    LAST);
    
    lr_end_transaction("车险查询", LR_AUTO);
    
     
    
    lr_output_message("找到参数个数为:%s", lr_eval_string("{CPlyNo_count}"));
    
    count=atoi( lr_eval_string("{CPlyNo_count}") );
    // atoi把字符串的数字转换为整形的数字
    
    for(i=1;i<=count;i++)
    {
    sprintf( CProdNo,"{CProdNo_%d}",i );
    
    sprintf( CAppNo,"{CAppNo_%d}",i );
    
    sprintf( CPlyNo,"{CPlyNo_%d}",i );
    
    sprintf( TCrtTm,"{TCrtTm_%d}",i );
    
    lr_output_message("第%d个保单,产品编号CProdNo为:%s", i, lr_eval_string(CProdNo));
    
    lr_output_message("投保单号CAppNo为:%s", lr_eval_string(CAppNo));
    
    lr_output_message("保单号CPlyNo为:%s", lr_eval_string(CPlyNo));
    
    lr_output_message("创建时间TCrtTm为:%s", lr_eval_string(TCrtTm));
    
    }
  • 相关阅读:
    面向对象编程(一)
    函数嵌套(闭包)、阶乘、斐波那数列知识
    函数的定义及用法
    常见例子
    Python解析JSON详解
    linux yum install mvn
    消息组件
    websphere 安装中出现JNDI资源找不到问题总结
    多业务Nginx解决方式
    python-pip 安装使用问题
  • 原文地址:https://www.cnblogs.com/liuyitan/p/6607033.html
Copyright © 2020-2023  润新知