Transactions in Loadrunner

Transactions in Loadrunner

Transactions in Loadrunner is classified into two types start and End transactions which is useful in identifying the response time taken for particular iterations or particular Actions for VUGen scripts. In my previous post you have learn web services scripting and Rest API scripting with examples,please read once for more information.

As i mention in LoadRunner transactions are divided into two transaction types ,those are

1.Start Transactions
2.End Transactions and one more is there
3.Sub Transactions but which will comes under Start Transaction only.

ALSO READ  loadRunner Failed to connect loadgenerator

ALSO READ

REST API scripting using Loadrunner
WebServices Scripting using Loadrunner
lr_xml_find Examples
Effort Estimation Preparation
lr_xml_extract examples

What is Transaction?

Transaction is nothing but verifying the response time taken to receive response from a server for a VUser requests, whether it is a single requests, Multiple requests etc.

For Example:

  • Execution of multiple SQL queries
  • User my account page is loading or displaying
  • Reports Generation as per search with the help of queries. Etc.
ALSO READ  Web Services Scripting Using Loadrunner

How to Insert Transactions – Loadrunner

In Virtual User generator scripts you can insert transaction as below.

lr_start_transaction(“Transaction name”);
lr_end_transaction(“Transaction Name”,LR_AUTO);
LR_AUTO :It can be PASS or FAIL,LR_PASS,LR_FAIL.

Sub Transactions – Loadrunner

Sub transactions useful in verify the response time of sub http request responses.

Main Transaction : User purchasing Product
Sub Transaction : Debit Card/Credit Card payment.

ALSO READ  Loadrunner Runtime Settings

Once Payment is success then only User Purchasing Product transaction will complete other-wise it get Fail, so it depends on Payment method.

Sub Transaction – Syntax

Lr_start_sub_transaction(“sub transaction name”,”parent transaction name”);
Lr_end_sub_transaction(“sub transaction name”,LR_AUTO);

Final code looks like below model

Lr_start_transaction("purchasing product");

..

Lr_start_sub_transaction("Payment_Method"," purchasing product");

..

Lr_end_sub_transaction("Payment_Method",LR_AUTO);

Lr_end_transaction("purchasing product",LR_AUTO);

Virtual User Script:

Action()
{ 
lr_start_transaction("01_Homepage");
web_url("www.wikishown.com", "URL=http://www.wikishown.com/", 
"Resource=0", 
"RecContentType=text/html", 
"Referer=", 
"Snapshot=t3.inf", 
"Mode=HTML",LAST)
Lr_start_sub_transaction("02_ManualTesting","01_Homepage"); 
lr_think_time(10); 
web_reg_find("Text=Manual Testing",LAST);
web_url("manual-testing", 
"URL=http://www.wikishown.com/manual-testing/", 
"Resource=0", 
"RecContentType=text/html", 
"Referer=http://www.wikishown.com/", 
"Snapshot=t4.inf", 
"Mode=HTML", 
EXTRARES, 
"URL=../wp-content/themes/sparkling/inc/fonts/glyphicons-halflings-regular.eot", 
ENDITEM, "URL=url, 
"URL=../favicon.ico", 
ENDITEM, LAST); 
lr_end_transaction("01_Homepage",LR_AUTO);
return 0;
}

Thank you for reading,pleases share this post with different social media so that many people will get knowledge.

Rajesh

Rajesh has over 8+ years of experience in Quality Assurance (Automation/ Manual). I've completed his B.Texh. He is an experienced software tester,work experience include working on tools like TestNG, Sikuli, Autoit, Selenium Builder and Appium, has worked on various projects from verticals like Retail, Insurance, Tolling and many more and passionate about designing Automation Frameworks that are effective and easy to maintain using Selenium Java.

One thought on “Transactions in Loadrunner

Leave a Reply

Your email address will not be published. Required fields are marked *