比较常用完整的Loadrunner关联功能

上一篇 / 下一篇  2012-03-28 17:31:51 / 个人分类:Loadrunner 应用

需求--进入一个页面后,页面列出了所有list的 内容。需要模拟将所有条目都点击一次。

必须知道这个模块下的所有条目是多少。数组的大小为执行循环次数。并且将取出的值作为URL中的参数

运行通过的代码

Action()

{

 char buffer[128] = {0};

 int j;

 int i;

  //取出所有的符合条件的值,保存在array

      web_reg_save_param("param1",

                          "LB=Bug.php?BugID=",

                          "RB=\" title=",

                          "Notfound=error",

                           "ord=all",

                           LAST);

        web_url("BugList.php_3",

        "URL=http://192.168.1.116/bugfree/BugList.php?",

        "TargetFrame=RightBottomFrame",

        "Resource=0",

        "RecContentType=text/html",

        "Referer=http://192.168.1.116/bugfree/BugList.php?ProjectID=1",

        "Snapshot=t11.inf",

        "Mode=HTML",

        LAST);

    //取出web_reg_save_param保存在array的数量

      j=atoi(lr_eval_string("{param1_count}"));

      lr_output_message("the j is %d",j);

    for(i=1;i<=j;i++)

      {

       //赋值给变量buffer

   sprintf(buffer, "{param1_%d}", i);

       lr_output_message("the conut is %s.",lr_eval_string(buffer));

        //变量转换成参数

       lr_save_string(lr_eval_string(buffer),"bufferstring");

 web_url("Bug.php",

    //使用参数

             "URL=http://192.168.1.116/bugfree/Bug.php?BugID={bufferstring}",

              "TargetFrame=",

             "Resource=0",

             "RecContentType=text/html",

             "Referer=http://192.168.1.116/bugfree/BugList.php?ProjectID=1",

              "Mode=HTML",

             LAST);

         }

   return 0;

}


TAG:

 

评分:0

我来说两句

日历

« 2024-05-09  
   1234
567891011
12131415161718
19202122232425
262728293031 

数据统计

  • 访问量: 6287
  • 日志数: 7
  • 建立时间: 2012-03-21
  • 更新时间: 2013-04-18

RSS订阅

Open Toolbar