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);

Sunday 25 August 2019

How to download and install Gatling tool | Gatling tool for Performance testing

Gatling is a highly capable load testing tool. It is designed for ease of use, maintainability and high performance.It is the best developer tool to load test your web applications.

Gatling comes with excellent support of the HTTP protocol that makes it a tool of choice for load testing any HTTP server. As the core engine is actually protocol agnostic, it is perfectly possible to implement support for other protocols.
Gatling’s architecture is asynchronous as long as the underlying protocol, such as HTTP, can be implemented in a non blocking way. This kind of architecture lets us implement virtual users as messages instead of dedicated threads, making them very resource cheap. Thus, running thousands of concurrent virtual users is not an issue.

How to download Gatling:

Click here to go download link and select click on open source version and click on download and once it is done extract the folder and place on C drive.

How to capture all HTTP Responses in load runner

If you want to capture the http response of a page, but some times it may redirects as HTTP 301,HTTP 302 etc

By using the below code we can capture the status code and write itin to a variable.

HttpRetCode = web_get_int_property(HTTP_INFO_RETURN_CODE);

You need to place it after all the page request in the script. However, this will only capture the LAST status code received. If there is a redirection in between, it will not be captured. So to capture that we need to use web_reg_save_param function with the following arguments.

Use "ORD=ALL" argument to capture all occurrences and 
use "Search=Headers" argument to search the response header only

web_reg_save_param("HttpResponses","LB=HTTP/1.1 ", "RB= ", "Search=Headers" ,"ORD=ALL", LAST);


The HttpResponse variable contains all http requests and output log as a message.

PSR Tool | Windows Problem Steps Recorder (PSR)

Problem steps recorder (PSR) is a tool that is available in Windows since Windows 7 (client) / Windows 2008 R2. It's a built-in Windows tool that allows to screen-capture on mouse-click and add comments to it. So it's an ideal tool to document steps and procedures on the fly, while you're executing. Although it's a very handy tool and quick and easy to use, one of the disadvantages is that it does not capture keystrokes.

Here is the process how to use it:

1. In Windows 7, go to start menu and type "psr"
2. When psr.exe shown up on menu, click on it to open
3. This will open the PSR tool window as shown in below



4. Click on the drop down and click settings and provide output location 





5. Set the screen capture to 100 (max) and press OK button

6. Click on Start Record button and start your flow

7. If you want add any comments click on Add Comments and write your comments.



8. Once you are done with you flow press Stop Record button. A window will open for saving the session.

9. You can attach this file to your defect.

10. This zip file will have all the screenshot with labels of each and every activity that was done.

Removing leading zero from the date in LoadRunner - 06/12/2020 to 6/12/2020

How to change 06/12/2020 to 6/12/2020? here is the code..

Action()
{
char month[10],day[10],year[10],startingDate[10]; //Declaration the variables here
int nonzeroday, nonzeromonth;

strcpy(startingDate,"");

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

lr_output_message(lr_eval_string("{normal_date}"));

lr_save_datetime("%m",DATE_NOW,"month"); //Capturing month of date to a parameter
lr_save_datetime("%d",DATE_NOW,"day");  //Capturing day of date to a parameter
lr_save_datetime("%Y",DATE_NOW,"year");//Capturing year of date to a parameter

nonzeromonth=atoi(lr_eval_string("{month}")); // This it to remove zero from the month value
lr_save_int(nonzeromonth,"month");

nonzeroday=atoi(lr_eval_string("{day}"));  // This it to remove zero from the day value
lr_save_int(nonzeroday,"day");


strcat(startingDate,lr_eval_string("{month}")); //Concatenating  date with '/' to create a date
strcat(startingDate,"/");
strcat(startingDate,lr_eval_string("{day}"));
strcat(startingDate,"/");
strcat(startingDate,lr_eval_string("{year}"));


lr_save_string(startingDate,"p_startingDate");
lr_output_message("Corrected Date is: %s", lr_eval_string("{p_startingDate}"));

return 0;
}

Then your final output will be:

Action.c(34): Today's Date is: 06/12/2020
Action.c(65): Corrected Date is: 6/12/2020

Script to generate random order number and pass to html element

Here is the sample script  to generate random order number and pass to html element:

<script>
function randomOrder(length, chars)
{
var string = '';
for (var i=length; i > 0; --i)
string += chars[Math.round(Math.random() * (chars.length - 1))];
return string;
}
var orderNum = randomOrder(7, '0123456789'); 
document.getElementById("order_num").innerHTML = "ORDER #GMO" +orderNum;
</script>

Wednesday 21 August 2019

What is Processor Queue Length? | Processor Queue length in performance testing

A collection of one or more threads that is ready but not able to run on the processor due to another active thread that is currently running is called the processor queue. The clearest symptom of a processor bottleneck is a sustained or recurring queue of more than two threads. Although queues are most likely to develop when the processor is very busy, they can develop when utilisation is well below 90 percent. This can happen if requests for processor time arrive randomly and if threads demand irregular amounts of time from the processor.

If queue occur frequently, You need to investigate the processes that are running when threads collect in the queue. Follow these to find:

  1. Identify the processes that are consuming processor time. Observe whether a single process or multiple processes are active during a bottleneck. Running processes appear in the Instance box when you select the Process\% Processor Time counter.
  2. Examine the processor-intensive processes. Determine how many threads run in the process and watch the patterns of thread activity during a bottleneck.Evaluate the priorities at which the process and its threads run. You might be able to eliminate a bottleneck merely by adjusting the base priority of the process or the current priorities of its threads. However, Microsoft does not recommend this as a long-term solution. Use Task Manager to find the base priority of the process.

Wednesday 17 July 2019

Continue on error in Load runner | lr_continue_on_error function in Load runner

Sometimes you may want the "Continue on error "to be enabled for some of the transactions and "Continue off on error" for some other transactions,then you need to use the below functions.
By using lr_continue_on_error function we can include a portion of the script instead of whole script. We need to enclose the requests that we are getting error in between lr_continue_on_error(1) and lr_continue_on_error(0)
With this load runner default http status codes will overridden on failures.

Example:

lr_continue_on_error(1);
web_url("EasyLoadrunner",
"URL=http://www.easyloadrunner.blogspot.com/",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Snapshot=t12.inf",
"Mode=HTML",
LAST );
lr_continue_on_error(0);


Syntax:

lr_continue_on_error(0) --> for no option after error 

lr_continue_on_error(1) --> for continue on error 

lr_continue_on_error(2) --> for skip to next option on error 

lr_continue_on_error(3) --> for skip to next iteration on error 

lr_continue_on_error(4) --> for end of VUser on error

Sunday 30 June 2019

Error 415 unsupported media type load runner | HTTP error code 415 unsupported in Vugen

If you are facing the  415 unsupported media type error in your Vugen scripting check the following things to resolve.

1.check all the headers (including authentication headers) and add if anything is missing.

web_add_header("AccessToken","{Test_Token}");
web_add_header("Authorization","{ABCTokenType} {ABCAccessToken}");
web_add_header("Accept","application/json, text/plain, */*");
web_add_header("Origin", "https://testsite.com");

2.Check with https and http

3.Try to add  "RecContentType=application/soap+xml", or    "RecContentType=application/json",

4.Method should be accurate "Method=POST or PUT or GET"

The code should be like this:

web_custom_request("ABC",
       "URL=https://xyz.com/abc",
       "Method=POST",
       "Snapshot=t67.inf",
       "RecContentType=application/soap+xml",
        "EncType=application/soap+xml; charset=utf-8",

        "Mode=HTML",
        "Body= xml request or Json request or other request", 
         LAST);


Tags:
LR 12.55 - PUT method - Error 415 unsupported media type
415 (Unsupported Media Type) in loadrunner
415 (Unsupported Media Type) in viugen

Saturday 23 February 2019

Testing is a Housewife's job ???

Testing is a Housewife's job ?

This is a statement I have heard many times in my career from various people. I used to oppose it. Today, I changed my mind. I accept it. It is a housewife's job.

I didn't know how hard being a housewife is. 

I thought they hardly do any work.
The only possible work they do is in the morning to get their kids and hubby ready to office. After that nothing at all.

Being a housewife is one of the hardest jobs in the world. It is...

The most underrated
The most under appreciated
The most underpaid

A housewife requires

To be disciplined
To work hard
To take care of multiple stakeholder expectations
To soak in a lot of pressure
To not complain
To deliver at odd times
To get last minute demands
People take their time and space for granted

My mom (like many other moms out there)
Has been a housewife
She is the source of the biggest success in our family.
Our success as children is coming at the cost of our mothers sacrificing their passion.

Why should I say No when people want to tell me "You are like your mom"

Those who laugh when they say testing job is for housewife's - they are disrespecting their own mother's job. 

Try being a housewife. You will run away.

Sunday 20 January 2019

Jmeter Results Dashboard | Jmeter Results Plugin | JWETER

Jweter is an open source tool that is useful for analysing and visualising Jmeter Results. It creates the time series and distribution graphs. JWeter is a tool for analyzing and visualing JMeter result (.jtl) files. It creates time series and distribution graphs, differentiating the various samples from your JMeter script (which for example could represent the various steps in a web flow) with different colors / graph labels, helping you to quickly spot the requests that have long response times.

DOWNLOAD from Here.
https://bitbucket.org/pjtr/jweter/downloads/

How to use Jweter:


JWeter icon
Download the jar file and run it with java -jar JWeter.jar, or double click the jar file (depends on OS). A wizzard will appear that will guide you through the steps to create a nice graph or error analysis. The graphs can be saved as png by right clicking and selecting "save as". Use mouse gestu res to zoom in (select rectangle) or zoom out (move to top left).
JMeter .jtl files.To let JMeter create .jtl files, add a Simple Data Writer listener to the test plan, enter a file name (the .jtl extension is commonly used, but not mandatory) and make sure to select "Save As XML" in the configuration panel.

Source: https://bitbucket.org/pjtr/jweter