• 飞机订票-1注册用户脚本


    一、要求:

    1、可以注册1000个用户

    2、要保证脚本可以持续的运行,不能说运行一次,就不能再运行

    3、做好手动事务判断

    二、思路:

    注册一次用户,用时间参数做用户名的参数化,然后迭代1000次

    三、脚本(看着乱,但粘贴到LR中就好了)

    Action() {

       web_url("WebTours",  

              "URL=http://127.0.0.1:1080/WebTours/",  

              "TargetFrame=",  

              "Resource=0",  

              "RecContentType=text/html",   

              "Referer=",

              "Snapshot=t1.inf",

              "Mode=HTML",   LAST);

     /*Thank you, elsa1, for registering and welcome to the Web Tours family. We hope we can meet all your current and future travel needs. If you have any questions, feel free to ask our support staff. Click below when you're ready to plan your dream trip*/    

           lr_start_transaction("flight_url");  

     web_reg_find("Search=All",   

             "SaveCount=sign_count",  

             "Text=First time registering? Please complete the form below.",   LAST);

     web_url("sign up now",   

             "URL=http://127.0.0.1:1080/WebTours/login.pl?username=&password=&getInfo=true",

             "TargetFrame=body",

             "Resource=0",  

             "RecContentType=text/html",   

             "Referer=http://127.0.0.1:1080/WebTours/home.html",   

             "Snapshot=t2.inf",  

            "Mode=HTML",   LAST);

       lr_output_message("############%s#############",lr_eval_string("{sign_count}"));

     web_reg_find("Search=All",  

            "SaveCount=sign_count1",   

            "Text=Thank you",   LAST);

     web_submit_data("login.pl",  

           "Action=http://127.0.0.1:1080/WebTours/login.pl",  

           "Method=POST",   

           "TargetFrame=info",  

           "RecContentType=text/html",   

           "Referer=http://127.0.0.1:1080/WebTours/login.pl?username=&password=&getInfo=true",

           "Snapshot=t3.inf",   

           "Mode=HTML",  

           ITEMDATA,  

          "Name=username",

          "Value=Li{Param1}", ENDITEM,  

          "Name=password", "Value=12345", ENDITEM,   

          "Name=passwordConfirm", "Value=12345", ENDITEM,   

          "Name=firstName", "Value=12345", ENDITEM,

          "Name=lastName", "Value=12345", ENDITEM,   

          "Name=address1", "Value=12345", ENDITEM,  

          "Name=address2", "Value=12345", ENDITEM,   

          "Name=register.x", "Value=24", ENDITEM,    

          "Name=register.y", "Value=9", ENDITEM,   LAST);  

      lr_output_message("%s",lr_eval_string("{Param1}"));

      lr_output_message("############%s#############",lr_eval_string("{sign_count1}"));  

      if(strcmp(lr_eval_string("{sign_count}"),"1")){  

                lr_output_message("******************************");  

                lr_end_transaction("flight_url",LR_FAIL);   }else{  

                         if(strcmp(lr_eval_string("{sign_count1}"),"1")){

                          lr_output_message("%%%%%%%%%%%%%%%%%%%%%%%%%%");     

                         lr_end_transaction("flight_url",LR_FAIL);       }else{   

                                 lr_output_message("#######################");  

     lr_end_transaction("flight_url",LR_PASS);  }

     }

     return 0;

    }

  • 相关阅读:
    Jobs(一)前端页面
    MySQL 聚合函数与count()函数
    计算机概论 64bit和32bit的CPU的不同
    Maven如何发布项目到一个Tomcat中
    创建一个简单的Maven工程
    Maven安装与配置
    Maven整合Spring与Solr
    solr应用
    hashCode()与equals()区别
    Callable与Future
  • 原文地址:https://www.cnblogs.com/Miss-Elsa/p/5866839.html
Copyright © 2020-2023  润新知