Thursday 20 November 2014

Random Co-relation in Web http/html Load Runner

Use following LR function to extract all the elements from the response

web_reg_save_param_ex("ParamName=cseatPref",
                                         "LB=name=\"seatPref\" value=\"""RB=\"",
                                         "Ordinal=ALL"LAST);

lr_save_string(lr_paramarr_random("cseatPref"), "cSeatPref_Value");

//lr_paramarr_random() function selects a random value from all extracted values
//lr_save_string() function saves value to a new variable

Replace seat preference value with {cSeatPref_Value} as following

web_submit_data("reservations.pl",
        "Action=http://127.0.0.1:1080/cgi-bin/reservations.pl",
        "Method=POST",
        "TargetFrame=",
        "RecContentType=text/html",
        "Referer=http://127.0.0.1:1080/cgi-bin/reservations.pl?page=welcome",
        "Snapshot=t4.inf",
        "Mode=HTML",
        ITEMDATA,
        "Name=advanceDiscount", "Value=0", ENDITEM,
        "Name=depart", "Value={cDep_City}", ENDITEM,
        "Name=departDate", "Value={Dep_date}", ENDITEM,
        "Name=arrive", "Value={cAri_City}", ENDITEM,
        "Name=returnDate", "Value={Arri_date}", ENDITEM,
        "Name=numPassengers", "Value=1", ENDITEM, 

      "Name=seatPref", "Value={cSeatPref_Value}", ENDITEM,
      "Name=seatType", "Value={c_SeatType}", ENDITEM,      
        LAST);

No comments:

Post a Comment