Skip to main content

lr_start_transaction Usage and Dynamic Transactions Generating withExamples

Why do you use lr_start_transaction?

It is mainly used to check the response time of a particular request. Enter google.com or bing.com, how much time Google or Bing has taken to load the page.

How to use lr_start_transaction?

lr_start_transaction to be inserted before beginning of a request/transaction, which you need to analyse the request/transaction. Lr_start_transaction and lr_end_transaction are inserted before and after the request. Each lr_start_transaction must have corresponding lr_end_transaction, otherwise vugen will consider as illegal statement.

Note: Do not use period(.) in transaction names. Period indicates end of transaction in vugen and analysis.

In this following example, lr_start_transaction starts a transaction whose purpose is to measure the response time of loadrunnerz.com. (How much time it take to load a page).

Example:
lr_start_transaction(Loadrunnerz_Home_Page);
 web_url("Loadrunnerz",
 "URL=http://www.loadrunnerz.com/",
 "TargetFrame=",
 "TargetBrowser=Loadrunnerz Home Page",
 "Resource=0",
 "RecContentType=text/html",
 "Snapshot=t1.inf",
 "Mode=HTML",
 LAST );
 lr_start_transaction(Loadrunnerz_Home_Page, LR_AUTO);

Once you run the script it will show you the response time of a transaction in output window.

How to Create Dynamic Transaction Names in Vugen:

Declare a buffer to store the dynamic searched string from the parameter. Put the buffer in the lr_start_transaction and lr_end_transaction function as the name of the transaction.

Example:

I created a parameter StepName in parameter and entered the values.

StepName

Step1
Step2
Step3...etc
Action1()
 {
 char buffer[30];
 web_url("www.loadrunnerz.com",
 "URL=http://www.loadrunnerz.com/",
 "RecContentType=text/html",
 LAST);
 sprintf(buffer, "ScriptName_%s", lr_eval_string("{StepName}"));
 lr_start_transaction (buffer);
 web_submit_form(buffer,
 ITEMDATA,
 "name=keywords","value=loadrunnerz",
 ENDITEM,
 LAST);
 lr_end_transaction (buffer, LR_AUTO);
 return 0;
 }

If you are looping the transaction and would like see that in the Analysis, each transaction from a different iteration is reported as a separate entry, you can also insert a count to the transaction name.

Example:
Action() {
 char buffer[20];
 int count;
 web_url("www.loadrunnerz.com",
 "URL=http://www.loadrunnerz.com/",
 "RecContentType=text/html",
 LAST);
 for( count=1; count<10; count++){
 sprintf(buffer, "ScriptName_%s_%d", lr_eval_string("{StepName}"), count);
 lr_start_transaction(buffer);
 web_submit_form("loadrunnerz",
 "Snapshot=t1.inf",
 ITEMDATA,
 "Name=keyword", "Value=loadrunnerz",
 ENDITEM,
 LAST);
 lr_end_transaction(buffer, LR_AUTO);
 count ++;
 }
 return 0;
 }

Comments

  1. Please correct the below line, It was wrongly mentioned in the above screenshot
    lr_start_transaction(Loadrunnerz_Home_Page, LR_AUTO);

    ReplyDelete
    Replies
    1. Correct. it should be: lr_end_transaction(Loadrunnerz_Home_Page, LR_AUTO);

      Thx,

      TL

      Delete
  2. hi sir, i have 2 questions regarding transactions

    1. which function is used to end a nested transaction?

    2. what is the difference between transaction and transaction instance?

    ReplyDelete

Post a Comment

Popular posts from this blog

NeoLoad Interview Questions and Answers

Here are some of the interview questions and answers on NeoLoad:
What is NeoLoad?
NeoLoad is a performance testing tool designed to test different types of web, standalone and mobile applications.
What is the difference between Loadrunner, JMeter and NeoLoad?
Click here for differences
What are the different counters you monitor in NeoLoad?
Average Response Time(requests), average response time(pages), average requests/s, average throughput, current response time(requests), current response time(pages), current requests, current throughput, current users count, controller cpu load, controller memory load etc.
What are the different type of tools you can integrate with NeoLoad?
App Dynamics, CA APM Integration, Dyna trace integration, HP ALM or Quality Center Integration, Java and Jamo Solutions M-eux Test Integration, Jenkins Integration, perfecto mobile integration, selenium integration.
What are the different type of Operating systems you can monitor?
Linux Monitor, Solaris Monitor, AIX …

Sitescope Monitoring Tool Features and Monitors

Why Sitescope is called Agentless Monitoring Tool?
HP SiteScope monitors the application/infrastructure/server/operating system without installing any agent software on the system to be monitored. This feature makes the installation, usage and maintenance of Sitescope simpler when compared with the any performance monitoring tools like Diagnostics.
Sitescope Monitors:
Sitescope has also upgraded and changed drastically to meet the rapidly changing technologies and environments like virtualization and cloud computing. Using Sitescope we can monitor different web servers, application servers and database servers. We can also monitor operating systems Windows, Linux, Sun Solaris, IBM AIX. It has more than 100 monitors including Weblogic, Websphere, SAP, SIEBEL, SNMP, LDAP, Network Monitor etc. HP SiteScope can also monitor cpu utilization, response time, disk space, and resource availability of a variety of host types and application platforms.
Sitescope Features:
SiteScope provides failover …

LR Functions with Examples | Loadrunner Functions with Examples

LR Functions in Loadrunner with Examples.

lr_abort Stops the script execution.lr_advance_param It will take the next value in the parameter list.lr_continue_on_error Continue on error even if the request is failed.lr_convert_string_encoding Converts a string to a UTF 8 or Unicode.lr_db_dataset_action Validates database contents by setting checkpoints.lr_db_connect Connects to a database.lr_db_dataset_action Performs an action on a dataset.lr_db_disconnect Disconnects from a database.lr_db_executeSQLStatement Submits an SQL statement to a database.lr_checkpoint Validates the value of a parameter against an expected value (checkpoint).lr_db_getValue Retrieves a value from a dataset.lr_debug_message Sends a debug message to the LoadRunner output or Application Management agent log file.lr_decrypt Decrypts an encoded string.lr_disable_ip_spoofing Disables IP Spoofing.lr_enable_ip_spoofing Enables IP Spoofing.lr_end_sub_transaction Marks the end of a sub-transaction.lr_end_transaction Mark…