• WebTours测试脚本分享(半成品练习)


    >>>>>

    1. 启动Web Tours服务。。双击启动。
    2. 输入网址:http://127.0.0.1:1080/WebTours/
    功能解说:
    1. Search Flights Button 订票。
    2. Itinerary Button 形成和查询历史信息。
    3. Home Button 首页。
    4. SignOff Button 退出。

    脚本源码:

    vuser_init脚本:

    vuser_init()
    {
            web_reg_save_param("session",
                           "LB=name="userSession" value="",
                           "RB="/>",
                           LAST);
        web_url("WebTours", 
            "URL=http://localhost:1080/WebTours/", 
            "TargetFrame=", 
            "Resource=0", 
            "RecContentType=text/html", 
            "Referer=", 
            "Snapshot=t77.inf", 
            "Mode=HTML", 
            LAST);
    
        lr_think_time(18);
    
        lr_start_transaction("1_denglu");
    
        web_submit_data("login.pl", 
            "Action=http://localhost:1080/cgi-bin/login.pl", 
            "Method=POST", 
            "TargetFrame=", 
            "RecContentType=text/html", 
            "Referer=http://localhost:1080/cgi-bin/nav.pl?in=home", 
            "Snapshot=t78.inf", 
            "Mode=HTML", 
            ITEMDATA, 
            "Name=userSession", "Value={session}", ENDITEM, 
            "Name=username", "Value=xhx", ENDITEM, 
            "Name=password", "Value=123", ENDITEM, 
            "Name=JSFormSubmit", "Value=on", ENDITEM, 
            "Name=login.x", "Value=72", ENDITEM, 
            "Name=login.y", "Value=15", ENDITEM, 
            LAST);
    
        lr_end_transaction("1_denglu",LR_AUTO);
        lr_output_message("这里是init");
        
        return 0;
    }

    action脚本:

    Action()
    {
    
    
        lr_think_time(14);
    
        lr_start_transaction("2_maipiao");
    
        web_url("Search Flights Button", 
            "URL=http://localhost:1080/cgi-bin/welcome.pl?page=search", 
            "TargetFrame=body", 
            "Resource=0", 
            "RecContentType=text/html", 
            "Referer=http://localhost:1080/cgi-bin/nav.pl?page=menu&in=home", 
            "Snapshot=t79.inf", 
            "Mode=HTML", 
            LAST);
    
        lr_think_time(7);
    //name="outboundFlight" value="010;723;07/16/2017"
        web_reg_save_param("outboundFlight",
                           "LB=name="outboundFlight" value="",
                           "RB=">",
                           "Ord=3",
                           LAST);
        web_submit_data("reservations.pl", 
            "Action=http://localhost:1080/cgi-bin/reservations.pl", 
            "Method=POST", 
            "TargetFrame=", 
            "RecContentType=text/html", 
            "Referer=http://localhost:1080/cgi-bin/reservations.pl?page=welcome", 
            "Snapshot=t80.inf", 
            "Mode=HTML", 
            ITEMDATA, 
            "Name=advanceDiscount", "Value=0", ENDITEM, 
            "Name=depart", "Value={departCity}", ENDITEM, 
            "Name=departDate", "Value=07/16/2017", ENDITEM, 
            "Name=arrive", "Value={arriveCity}", ENDITEM, 
            "Name=returnDate", "Value=07/17/2017", ENDITEM, 
            "Name=numPassengers", "Value=1", ENDITEM, 
            "Name=seatPref", "Value=Window", ENDITEM, 
            "Name=seatType", "Value=First", ENDITEM, 
            "Name=.cgifields", "Value=roundtrip", ENDITEM, 
            "Name=.cgifields", "Value=seatType", ENDITEM, 
            "Name=.cgifields", "Value=seatPref", ENDITEM, 
            "Name=findFlights.x", "Value=68", ENDITEM, 
            "Name=findFlights.y", "Value=3", ENDITEM, 
            LAST);
    
        web_submit_data("reservations.pl_2", 
            "Action=http://localhost:1080/cgi-bin/reservations.pl", 
            "Method=POST", 
            "TargetFrame=", 
            "RecContentType=text/html", 
            "Referer=http://localhost:1080/cgi-bin/reservations.pl", 
            "Snapshot=t81.inf", 
            "Mode=HTML", 
            ITEMDATA, 
            "Name=outboundFlight", "Value={outboundFlight}", ENDITEM, 
            "Name=numPassengers", "Value=1", ENDITEM, 
            "Name=advanceDiscount", "Value=0", ENDITEM, 
            "Name=seatType", "Value=First", ENDITEM, 
            "Name=seatPref", "Value=Window", ENDITEM, 
            "Name=reserveFlights.x", "Value=18", ENDITEM, 
            "Name=reserveFlights.y", "Value=12", ENDITEM, 
            LAST);
            
            
        //<small><B>Thank you for booking through Web Tours.</B></small>
            web_reg_save_param("msg",
                           "LB=<small><B>",
                           "RB=</B></small>",
                           LAST);
        
        web_submit_data("reservations.pl_3", 
            "Action=http://localhost:1080/cgi-bin/reservations.pl", 
            "Method=POST", 
            "TargetFrame=", 
            "RecContentType=text/html", 
            "Referer=http://localhost:1080/cgi-bin/reservations.pl", 
            "Snapshot=t82.inf", 
            "Mode=HTML", 
            ITEMDATA, 
            "Name=firstName", "Value=xxxxxxxxxxx", ENDITEM, 
            "Name=lastName", "Value=xx", ENDITEM, 
            "Name=address1", "Value=", ENDITEM, 
            "Name=address2", "Value=", ENDITEM, 
            "Name=pass1", "Value= ", ENDITEM, 
            "Name=creditCard", "Value=", ENDITEM, 
            "Name=expDate", "Value=", ENDITEM, 
            "Name=oldCCOption", "Value=", ENDITEM, 
            "Name=numPassengers", "Value=1", ENDITEM, 
            "Name=seatType", "Value=First", ENDITEM, 
            "Name=seatPref", "Value=Window", ENDITEM, 
            "Name=outboundFlight", "Value={outboundFlight}", ENDITEM, 
            "Name=advanceDiscount", "Value=0", ENDITEM, 
            "Name=returnFlight", "Value=", ENDITEM, 
            "Name=JSFormSubmit", "Value=off", ENDITEM, 
            "Name=.cgifields", "Value=saveCC", ENDITEM, 
            "Name=buyFlights.x", "Value=59", ENDITEM, 
            "Name=buyFlights.y", "Value=9", ENDITEM, 
            LAST);
        
        if(strstr(lr_eval_string("{msg}"),"Thank you for booking through Web Tours")!=NULL)
        {
            lr_end_transaction("2_maipiao",LR_PASS);
            lr_output_message("订票成功,departCity:%s,arriveCity:%s",
                              lr_eval_string("{departCity}"),
                              lr_eval_string("{arriveCity}"));
        }
        else
        {
            lr_end_transaction("2_maipiao",LR_FAIL);
            lr_output_message("订票失败!");
        }
          //lr_end_transaction("2_maipiao",LR_AUTO);
        //AUTO:自动结尾,不判断正确和错误
        //PASS:以成功状态结束
        //FAIL:以失败状态结束
    
    
    
        return 0;
    }

    vuser_end脚本:

    vuser_end()
    {
            lr_think_time(17);
    
        lr_start_transaction("3_tuichu");
    
        web_url("SignOff Button", 
            "URL=http://localhost:1080/cgi-bin/welcome.pl?signOff=1", 
            "TargetFrame=body", 
            "Resource=0", 
            "RecContentType=text/html", 
            "Referer=http://localhost:1080/cgi-bin/nav.pl?page=menu&in=flights", 
            "Snapshot=t83.inf", 
            "Mode=HTML", 
            LAST);
    
        lr_end_transaction("3_tuichu",LR_AUTO);
        lr_output_message("这里是end");
        return 0;
    }

    >>>>>

  • 相关阅读:
    调整数组顺序使奇数位于偶数前面
    数值的整数次方
    矩形覆盖
    变态跳台阶
    跳台阶
    ubuntu图形界面切换文字界面(文字界面切换图形界面)
    Django环境安装、虚拟机端口映射、pycharm远程配置
    sql注入(一)-----数字型
    mysql基本语法
    渗透测试之------信息收集
  • 原文地址:https://www.cnblogs.com/xuehx/p/7346196.html
Copyright © 2020-2023  润新知