Thursday 31 October 2019

No “Stop_time” value defined in Results file of LR | stop_time=0 issue load runner analysis

When you open an analysis file, you may receive the error No Stop time value defined in LR Results file.
To acquire the results, simply follow the steps below.

  • Right-click the lrr file and select Open with Notepad++ or Notepad.
  • In the.lrr file, change the value of stop time.
  • If stop time=0 appears in that list, modify it to stop time=1.
  • If the analysis file lrr does not have a stop time line, add stop time=endtime.
  • The time at the end should be in epoch format.
  • To convert your local time to epoch time, use this converter.
  • Save and close the file.

Here's an example of a lrr file:


Version=12.0.0.0 Product=HP LoadRunner Controller Path=E:xxx.lrs
Subject=Baseline
Result file=D:\easyloadrunner\Results\Perftest.lrr
ResultName=xxx ResultName=xxx ResultName=xxx ResultName=x
Time Zone=21600
Start time=1406841216
Daylight Bias=-60
Stop time=1406877216
Public local=1 (Configuration)
Is mix=1
Is runner file=0
[Running mode] Runner file=
By command, start reason=
By command, stop reason=

Thursday 10 October 2019

Capture correlation value from response headers | CsrfToken Value Correlation

To capture the csrf token value in headers you need to do one thing prior to enhance the script.
  1. Go to Recording Options
  2. HTTP properties
  3. Advanced
  4. Headers and add 'csrf-token' or select 'Record header not in list'.Then record the script or regenerate the script.
Please note that the header name in web_add_header is without the colon (:) or space. The right boundary in web_reg_save_param function should be \r\n 

web_add_header("csrf-token","{CsrfToken}"");


In header server response the token value looks like this
x-csrf-token: 0FTwrefb89ijdhdhky0lkdkdkkrelw0rIw==

The final function should be as follows


web_reg_save_param("XCsrfToken","LB=x-csrf-token: ","RB=\r\n","Search=Headers",LAST);

Monday 7 October 2019

Different type of LR messages in load runner | lr_message() lr_output_message() lr_log_message() lr_error_message() lr_set_debug_message() lr_vuser_status_message()

lr_message(): This is a message function that is used to send a message(s) to the log and the output window.

lr_output_message(): This is a message function that is used to send the message(s) with details like the script section and line number to output windows, log files and other test report summaries.

lr_log_message(): This is a message function that is used to send a message(s) to the Vuser or agent log file and not to the output window.

lr_error_message(): This is a message function that is used to send a message(s) to the output windows, log files and other test report summaries.

lr_set_debug_message(): This function changes the message logging level (for a part of the script) from what is set in the Run-Time settings. As shown below, a full trace is enabled only for the ‘index.htm’ request (even if the log level is set to ‘Standard log’ in Run-Time settings).

lr_vuser_status_message(): This function sends a message to the Vuser status area of the Controller and to the Vuser log.

Sunday 6 October 2019

LR_EXIT functions in Load runner

LR_EXIT_VUSER : Exit without any condition and go directly to vuser_end action

LR_EXIT_ACTION_AND_CONTINUE : Stop current action and go to the next action

LR_EXIT_ITERATION_AND_CONTINUE: Stop the current iteration and go to the next iteration

LR_EXIT_VUSER_AFTER_ITERATION: Exit after the current iteration run is completed

LR_EXIT_VUSER_AFTER_ACTION: Exit after the current action run is completed

Saturday 5 October 2019

Difference between lr_eval_string and lr_eval_string_ext in load runner

lr_eval_string(): This function returns the input string after evaluating any embedded parameters.

lr_eval_string_ext(): This function creates a buffer and assigns it to the input string after evaluating the embedded parameters.

Friday 4 October 2019

Difference between Web_add_header And Web_add_auto_header in load runner

There is a simple difference between these 2 functions,lets have a look.

Web_add_header:
Web_add_header function is used to add header only to HTTP request that follows it.

web_add_auto_header:

Web_add_auto_header function is used to add header to all the consecutive HTTP requests.
Web scripts usually send the standard header requests automatically for each request. If you need additional headers to be sent then you can use web_add_header or web_add_auto_header.

How to enable Web_add_header and web_add_auto_header:
These are automatically generated in your script, if you enable this in Record -> re cording options->Advanced->Headers->Record Headers not in list.

Thursday 3 October 2019

How to capture whole body of Web page with Load runner Vugen?

Sometimes there may be a requirement to capture whole web page body and here is the code for this.

int MyFile;
char *TargetFileName = "C:\Users\pc\Desktop\Webpage.html";

Place web_reg_save_param before the web_url

web_url("EasyLoadrunner",
"URL= https://easyloadrunner.blogspot.com/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t11.inf",
"Mode=HTML",
LAST); 

left and right boundaries should be empty to capture the whole body

web_reg_save_param("WholeWebPage", "LB=", "RB=", "Search=Body", "RelFrameID=1", LAST);

Now write the captured web page in to a file

lr_output_message("Page is: \r\n%s", lr_eval_string("{WholeWebPage}"));

Truncate to zero length or create file for writing the whole page

if ((MyFile = fopen(TargetFileName, "wb")) == NULL)
{
lr_error_message("Cannot open %s", TargetFileName);
return LR_FAIL;
}


print the captured Web page to an output file

fprintf(MyFile, "%s", lr_eval_string("{WholeWebPage}"));
fclose(MyFile);