Skip to main content


Showing posts from March, 2014

Correlation and checking in Results

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.
        "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, 

As we see above the outboundFlight and returnFlight is hard coded and needs to be correlated according to the selected value.
So inserting the correlating statements as below. These values are return…

How to choose a value randomly from the list

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("",
"Name=advanceDiscount", "Value=0", ENDITEM,
"Name=depart", "Value=London", ENDITEM,
"Name=departDate", "Value=03/28/2014", ENDITEM,
"Name=arrive", "Value=Paris", ENDITEM,
"Name=returnDate", "Value=03/29/2014", ENDITEM,
"Name=numPassengers", "Value=1", ENDITEM,
"Name=roundtrip", "Value=on", ENDITEM,

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

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


//Declaration of variables
char month[10],day[10],year[10],startDate[10];
int nonzeroday, nonzeromonth;

//nullifying the startDate 

//Capturing Today's date and output to Log
lr_save_datetime("Today's Date is: %m/%d/%Y",DATE_NOW,"normal_date");

//Capturing each part of date to a parameter

//To remove zero from month

//To remove zero from day