当前位置: 首页 > news >正文

Loadrunner关联的内容是数组的解决办法

/广告:普遍真理实验室http://commonright.lingd.net
1、在action开头定义要用带的变量
    int istemp=0;//控制循环的游标
    int count=0;//存储关联出来的参数数量一般在关联参数后面加上_count就可以获得namejpeg_count
    char temp[255];//存储生成的关联参数namejepg_1,namejepg_2
    char temptolr[255];//存储temp内部存储的字符串//广告:普遍真理实验室http://commonright.lingd.net
2、获取关联数组
    web_reg_save_param("namejpeg","LB=img1.jike.com:82/get?name=","RB=\"","ORD=ALL","SEARCH=BODY",LAST);//广告:普遍真理实验室http://commonright.lingd.net
3、计算关联数组的个数
//获取关联出的字符串数组的大小,通过c语言的atoi函数将字符串转换成整形变量
    //namejpeg_count是关联函数自己定义的不是我们自己声明的因此这里要用("{namejpeg_count}")调用
    count = atoi(lr_eval_string("{namejpeg_count}"));//广告:普遍真理实验室http://commonright.lingd.net
4、获取各个关联数组变量
sprintf(temp,"{namejpeg_%d}",istemp+1);//每次循环应用的不同的namejpeg_X
//广告:普遍真理实验室http://commonright.lingd.net
        sprintf(temptolr,"%s",lr_eval_string(temp));//namejpeg_X存储的关联字符串存入temptolr变量中。
                                                    // 由于temp是在action开头自己声明的,因此 不需要应用“{}”调用
        lr_save_string(temptolr,"tempname");//C的变量不能直接在LR的API里调用,所以必须用lr_save_string进行转换。下面应用tempname就可以了
        web_url("get",
        "URL=http://img1.jike.com:82/get?name={tempname}",
        "Resource=1",
        "RecContentType=application/octet-stream",
        "Referer=http://image.jike.com/so?q={searchparam}",
        "Snapshot=t26.inf",
        LAST);//广告:普遍真理实验室http://commonright.lingd.net
5、这个脚本是录制即刻图片搜索的脚本action函数整体脚本如下:
Action()
{
    //---init//广告:普遍真理实验室http://commonright.lingd.net
    int istemp=0;//控制循环的游标
    int count=0;//存储关联出来的参数数量一般在关联参数后面加上_count就可以获得namejpeg_count
    char temp[255];//存储生成的关联参数namejepg_1,namejepg_2
    char temptolr[255];//存储temp内部存储的字符串
    web_url("index.php",
        "URL=http://image.jike.com/index.php",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=",
        "Snapshot=t1.inf",
        "Mode=HTTP",
        LAST);//广告:普遍真理实验室http://commonright.lingd.net
    web_concurrent_start(NULL);
    web_url("helpers-min.js",
        "URL=http://image.jike.com/js/helpers-min.js",
        "Resource=1",
        "RecContentType=application/x-javascript",
        "Referer=http://image.jike.com/index.php",
        "Snapshot=t2.inf",
        LAST);
    web_url("homeImg.css",
        "URL=http://image.jike.com/style/homeImg.css",
        "Resource=1",
        "RecContentType=text/css",
        "Referer=http://image.jike.com/index.php",
        "Snapshot=t3.inf",
        LAST);//广告:普遍真理实验室http://commonright.lingd.net
    web_url("baseNew.css",
        "URL=http://image.jike.com/style/baseNew.css",
        "Resource=1",
        "RecContentType=text/css",
        "Referer=http://image.jike.com/index.php",
        "Snapshot=t4.inf",
        LAST);
    web_url("logoImg.gif",
        "URL=http://image.jike.com/images/logo/logoImg.gif",
        "Resource=1",
        "RecContentType=image/gif",
        "Referer=http://image.jike.com/index.php",
        "Snapshot=t5.inf",
        LAST);//广告:普遍真理实验室http://commonright.lingd.net
    web_url("14",
        "URL=http://imagebg.jike.com/recommendPicture/img/GetImg/rpid/14",
        "Resource=1",
        "RecContentType=image/jpeg",
        "Referer=http://image.jike.com/index.php",
        "Snapshot=t7.inf",
        LAST);
    web_url("16",
        "URL=http://imagebg.jike.com/recommendPicture/img/GetImg/rpid/16",
        "Resource=1",
        "RecContentType=image/jpeg",
        "Referer=http://image.jike.com/index.php",
        "Snapshot=t8.inf",
        LAST);
    web_url("10",
        "URL=http://imagebg.jike.com/recommendPicture/img/GetImg/rpid/10",
        "Resource=1",
        "RecContentType=image/jpeg",
        "Referer=http://image.jike.com/index.php",
        "Snapshot=t9.inf",
        LAST);
    web_url("12",
        "URL=http://imagebg.jike.com/recommendPicture/img/GetImg/rpid/12",
        "Resource=1",
        "RecContentType=image/jpeg",
        "Referer=http://image.jike.com/index.php",
        "Snapshot=t10.inf",
        LAST);//广告:普遍真理实验室http://commonright.lingd.net
    web_url("13",
        "URL=http://imagebg.jike.com/recommendPicture/img/GetImg/rpid/13",
        "Resource=1",
        "RecContentType=image/jpeg",
        "Referer=http://image.jike.com/index.php",
        "Snapshot=t11.inf",
        LAST);
    web_url("15",
        "URL=http://imagebg.jike.com/recommendPicture/img/GetImg/rpid/15",
        "Resource=1",
        "RecContentType=image/jpeg",
        "Referer=http://image.jike.com/index.php",
        "Snapshot=t12.inf",
        LAST);//广告:普遍真理实验室http://commonright.lingd.net
    web_concurrent_end(NULL);
    web_url("BgBase.gif",
        "URL=http://image.jike.com/images/bg/BgBase.gif",
        "Resource=1",
        "RecContentType=image/gif",
        "Referer=http://image.jike.com/index.php",
        "Snapshot=t6.inf",
        LAST);
    web_url("favicon.ico",
        "URL=http://image.jike.com/favicon.ico",
        "Resource=1",
        "RecContentType=image/x-icon",
        "Referer=",
        "Snapshot=t13.inf",
        LAST);//广告:普遍真理实验室http://commonright.lingd.net
    lr_start_transaction("0-search");
    web_reg_save_param("namejpeg","LB=img1.jike.com:82/get?name=","RB=\"","ORD=ALL","SEARCH=BODY",LAST);
    web_submit_data("so",
        "Action=http://image.jike.com/so",
        "Method=GET",
        "EncType=",
        "RecContentType=text/html",
        "Referer=http://image.jike.com/index.php",
        "Snapshot=t14.inf",
        "Mode=HTTP",
        ITEMDATA,
        "Name=q", "Value={searchparam}", ENDITEM,
        LAST);//广告:普遍真理实验室http://commonright.lingd.net
    web_concurrent_start(NULL);
    web_url("ie6listPage.css",
        "URL=http://image.jike.com/style/ie6listPage.css",
        "Resource=1",
        "RecContentType=text/css",
        "Referer=http://image.jike.com/so?q={searchparam}",
        "Snapshot=t15.inf",
        LAST);
    web_url("ie6ImgBD.css",
        "URL=http://image.jike.com/style/ie6ImgBD.css",
        "Resource=1",
        "RecContentType=text/css",
        "Referer=http://image.jike.com/so?q={searchparam}",
        "Snapshot=t16.inf",
        LAST);//广告:普遍真理实验室http://commonright.lingd.net
    web_url("ie6baseNew.css",
        "URL=http://image.jike.com/style/ie6baseNew.css",
        "Resource=1",
        "RecContentType=text/css",
        "Referer=http://image.jike.com/so?q={searchparam}",
        "Snapshot=t17.inf",
        LAST);
    web_url("jike-autoComplete-min.js",
        "URL=http://image.jike.com/js/jike-autoComplete-min.js",
        "Resource=1",
        "RecContentType=application/x-javascript",
        "Referer=http://image.jike.com/so?q={searchparam}",
        "Snapshot=t18.inf",
        LAST);
    web_url("jike-log-min.js",
        "URL=http://image.jike.com/js/jike-log-min.js",
        "Resource=1",
        "RecContentType=application/x-javascript",
        "Referer=http://image.jike.com/so?q={searchparam}",
        "Snapshot=t19.inf",
        LAST);//广告:普遍真理实验室http://commonright.lingd.net
    web_url("ajax-min.js",
        "URL=http://image.jike.com/js/ajax-min.js",
        "Resource=1",

相关文章:

  • OpenLayers 地图投影转换
  • Python6.5打卡(day37)
  • 内部样式:深入解析与应用指南
  • 2.7.4制药CMC统计应用之单个总体非独立测量的未来所有值的耐受区间
  • 全面解析网络端口:概念、分类与安全应用
  • Qt/C++学习系列之QButtonGroup的简单使用
  • 小黑在问题中的日积月累:Pydantic的简单使用
  • 邮件多分类
  • Linux中INADDR_ANY详解
  • LangchainRAG you need - 段落拆分
  • StarRocks
  • 串:BF算法(朴素的魔术匹配算法)
  • c++ chrono头文件含义
  • NGINX `ngx_stream_core_module` 模块概览
  • 软考 系统架构设计师系列知识点之杂项集萃(82)
  • centos查看开启关闭防火墙状态
  • 9.axios底层原理,和promise的对比(2)
  • AI Agent 项目 SUNA 部署环境搭建 - 基于 MSYS2 的 Poetry+Python3.11 虚拟环境
  • git连接本地仓库以及gitee
  • 验证电机理论与性能:电机试验平板提升测试效率
  • 像淘宝购物网站建设需要哪些专业人员/百度seo搜索引擎优化培训
  • 设计高端网站/创建网站教程
  • 济南室内设计学校/西安seo主管
  • 免费网站怎么做啊/互联网推广是什么意思
  • codeorg免费编程网站/关键词歌词任然
  • dedecms导购网站模板/微信营销案例