Posts

Showing posts from March, 2014

Correlation and checking in Results

Image
Correlation and checking In Previous post we have randomly selected value for depart and arrive. Each Depart and arrive have a outboundFlight and returnFlight field, which changes according to the selected values. For E.g.: When we recorded the script with depart as “London” and arrive as “Paris” the below flight details was recorded accordingly to the selection.      /*web_submit_form("reservations.pl_2",          "Snapshot=t5.inf",          ITEMDATA,          "Name=outboundFlight", "Value=241;97;03/28/2014", ENDITEM,          "Name=returnFlight", "Value=422;102;03/29/2014", ENDITEM,          "Name=reserveFlights.x", "Value=26", ENDITEM,          "Name=reserveFlights.y", "Value=8", ENDITEM,          LAST); */ As we see above the outboundFlight and returnFlight is hard coded and needs to be correlated according to the selected value. So inserting the c

How to choose a value randomly from the list

Image
How to choose a value randomly from the list For demonstrating the example, we will use the sample application (HP Web Tours Application).  This application shows a sample where we can book flight tickets. The options in depart and arrive are shown as below: web_submit_data ( "reservations.pl" ,          " Action = http://127.0.0.1:1080/cgi-bin/reservations.pl " ,          " Method = POST " ,          " 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 = London " ,  ENDITEM ,          " Name = departDate " ,  " Value = 03/28/2014 " ,  ENDITEM ,          " Name = arrive " ,  "

Examples on Date and Time in LoadRunner

Following are some examples in Datetime Format: Datetime Format Codes The following format codes are supported for lr_save_datetime. Code Description %a day of week, using locale's abbreviated weekday names %A day of week, using locale's full weekday names %b month, using locale's abbreviated month names %B month, using locale's full month names %c date and time as %x %X %d day of month (01-31) %H hour (00-23) %I hour (00-12) %j number of day in year (001-366) %m month number (01-12) %M minute (00-59) %p locale's equivalent of AM or PM, whichever is appropriate %S seconds (00-59) %U week number of year (01-52), Sunday is the first day of the week. Week number 01 is the first week with four or more January days in it. %w day of week

Removing leading zero from the date in LoadRunner

Below few lines shows how to remove leading zero from date. Like We have a date as 03/26/2014 The output should be 3/26/2014 If the date is 03/01/2014 The output should be 3/1/2014 Solution: Action () {      //Declaration of variables      char  month[ 10 ],day[ 10 ],year[ 10 ],startDate[ 10 ];      int  nonzeroday, nonzeromonth;      //nullifying the startDate       strcpy (startDate, "" );      //Capturing Today's date and output to Log      lr_save_datetime ( "Today's Date is: %m/%d/%Y" , DATE_NOW , "normal_date" );      lr_output_message ( lr_eval_string ( "{normal_date}" ));      //Capturing each part of date to a parameter      lr_save_datetime ( "%m" , DATE_NOW , "month" );      lr_save_datetime ( "%d" , DATE_NOW , "day" );      lr_save_datetime ( "%Y" , DATE_NOW , "year" );      //To remove zero from month     nonzeromonth= atoi ( lr_eval_st