Loadrunner Tutorials, PDFs, PPTs and Documents

//
Read More

Loadrunner Web Services Tutorial Scripting in Two Ways

//
Web Services in loadrunner: We can do web Services scripting in two ways:
  1. By using Web Services Protocol. (Need additional License)
  2. By using Web Protocol.

Scripting using Web Services Protocol:

I have taken weather web service as example shown in this link.

Steps:
  1. First open the vugen and select Web Services protocol.
  2. Click on Manage Services on top nav bar and Click on Import and give the WSDL URL which is usually ends with .wsdl

Now Click on Add Web Service Call on top nav bar. Give the Input Arguments and Leave the out put arguments empty. And click on ok. As shown in the following image.

Input Arguements in Web Services
Input Arguements in Web Services
It will create a script in loadrunner as shown below. You can perform the steps one by one in this way for all the web services steps. You can use lr_xml_find and lr_xml_get_values to validate the page.

web_service_call"StepName=GetCitiesByCountry_101",
        "SOAPMethod=GlobalWeather|GlobalWeatherSoap|GetCitiesByCountry",
        "ResponseParam=response",
        "Service=GlobalWeather",
        "ExpectedResponse=SoapResult",
        "Snapshot=t1396977083.inf",
        BEGIN_ARGUMENTS,
        "CountryName=India",
        END_ARGUMENTS,
        BEGIN_RESULT,
        END_RESULT,
        LAST);

Using Web Protocol:

We can create the same request using Web (HTTP/HTML) protocol. You need take the xml request as shown in the following and place in the web custom request.

XML Request Example for Web Custom Request
XML Request Example for Web Custom Request
You need to keep this soap request in the web request body. As shown below and you can capture all the response using correlation function. You can also add check point using web_reg_find. The url should start end with .asmx as shown in the request.

web_reg_find("Text/IC=New Delhi",
        LAST);

  web_reg_save_param_ex(
        "ParamName=Web Service Response",
        "LB=",
        "RB=",
        SEARCH_FILTERS,
        LAST);
  
    web_custom_request("Weather SOAP Request",
      "URL=http://www.webservicex.net/globalweather.asmx",
      "Method=POST",
      "TargetFrame=",
      "Resource=0",
      "RecContentType=text/xml",
      "Referer=",
      "Mode=HTML",
      "EncType=text/xml; charset=utf-8",
      "Body= Your Request should be here as shown in the following image"
      LAST);

Web Custom Request with Web Services


Read More

Different Ways to do Correlation in Loadrunner You Must Know

//

1. Generation Log

One of the common options in loadrunner is generation log. You will take the left and right boundary and search in the generation log and use CTRL+F and find the request name and place the web_reg_save_param before that request.

2. Replay Log

Sometime you do not find correlation value in generation log than the alternative way is go to run time settings and click on Log->Extended Log-> "Data Returned by Server" option and replay the script. Once you replay the script you will use CTRL+F and find the left and right boundaries. Sometimes replay log may fail or it will take a long time if you select “data returned by server” as it is printing all the response to the replay log then the alternate method to use is  lr_set_debug_message as shown in this link.

3. Redirection

If you are not able to find the value in generation log and replay log then there might be 301 or 302 redirection.  Find out the pages that have 301 or 302 redirection. Once you find the pages that have 301 redirection go to that page manually in your browser, try to find the left and right boundary values by using view source (Left Click on the page -> "View Page Source" in chrome and "View Source" in internet explorer).

4. Text Flags:

Sometime you find the value, but the left and right boundaries will by changing dynamically then the alternate option is using text flags SaveLen and SaveOffset.

5. Automatic Correlation (Design Studio):


One of the best method that has from loadrunner 11.5 and loadrunner 12 is updated automatic correlation called design studio. It has improved a lot from this version. You can do the scripting at a faster pace by using this option.

Once you record the application go to Design-> Design Studio. The Design Studio will highlight the different values that need to be done correlation. Based on our requirement, we will select the value click on correlate value. We can also add it as “Add as Rule”. It will be easy if we are reusing the correlation in other scripts.

Note: Make sure you select the following option:

Go to Recording Options ->Correlation->Configuration-API and select web_reg_save_param_ex.  You can also use web_reg_save_param_regexp as well. I prefer using web_reg_save_param_ex.

At last please add up if you know any other option to get a correlation value that helps other readers.
Read More

Loadrunner Interview Questions and Answers

//
Hello, looking for interview questions in loadrunner? I have tried my level best to put these interview questions. If you find any new questions, you can always send me through the contact form below. I will include them in this list. Never give up in the interview. If you fail in one interview try for another interview, try and try until you get success. If you need any help you can always contact me through the contact form below. I will reply as soon as possible. All the best for your interview!!!!

I have categorized the loadrunner interview questions and answers into 5 parts:
  1. Performance Testing
  2. Loadrunner General Questions
  3. Vugen and Scripting
  4. Controller
  5. Analysis

Performance Testing Interview Questions and Answers:

What is Performance Testing?

Performance Testing on a software application is done  to determine how speed, stability and scalability the application is. Speed refers to how fast the software application will respond, and stability refers to how the application handles varying workloads. Scalability is the total amount of workload the software application can handle.

What is Load Testing?

It is done to understand how varying expected loads would make the system behave. For instance, its behavior if they were many users concurrently using the same application to carry out critical transactions for a certain period of time. It is able to give the application's response time for all the important transactions in a business. Load testing can be done for a business's database and servers which will be very helpful in identifying any existent bottlenecks.

What is Stress Testing?

This is done to determine whether the software application can still perform well even in cases of extreme load. It helps the application administrators know to what extent the application can be stretched without creating bottlenecks.

What is Soak Testing?

Soak testing monitors the system's performance over time. It is also referred to as endurance testing. It aims at determining the system's capability to sustain the normal load over time. The test involves looking out for potential leaks by monitoring memory utilization, as well as performance degradation. Performance degradation refers to the system's response time over a prolonged period of sustained use. Does it remain constant, improve or decline? Results of this test are derived from application of a significant amount of load to the system for a particular period of time.

What is Spike Testing?

This test involves a sudden increase in the amount of load, for instance a sudden increase in the number of users making transactions using the application. It is meant to determine whether the system will crash, slow down or whether it will be able to handle the surge.

What is Isolation Testing?

This is usually a repeat of the test execution that had caused a problem in the system. It is done to confirm the domain in which the fault had occurred.

What is Volume Testing?

It is a non-functional test. A certain amount of data is used to test the software application. The data can be a database or an interface file like .dat or. xml. To volume test the database, expand it to the desired size and then test the application for it. If you need the application to interact with a specific interface file, get a sample of the size you desire and then run the application.

What is Failover Testing?

Failover testing is done in order to determine if a server fails during the heavy load: Is load balancer able to react quickly and is able to drive the traffic to another web server/application server. Is the other web server/application server able to handle the unexpected load. This test helps to determine how the server behaves during these type of scenarios.

Explain the performance test life cycle that you follow?
  • Gathering the requirements from client
  • Understanding the architecture/environment of the application
  • Planning and Designing the tests
  • Preparing and enhancing the scripts
  • Executing the tests in controller
  • Analyzing the results
  • Fine tuning the application
  • Retesting the application after fine tuning the application and repeat this process until we meet the SLA (Not 100% up to 90% at least).
What are all the requirements you gather from your client for performance testing?
  • The architecture of the application and the technologies used to develop the application?
  • What is a web server, application server and database server?
  • What are the browsers and Java versions supported by the application?
  • What are the different load balance techniques used?
  • What are the protocols used between client and server? Ex: HTTP, HTTPS, FTP etc.
  • What are the Business scenarios we need to test?
  • What are the preferred tools for performance testing and monitoring? Ex: Loadrunner, Jmeter, Sitescope and Wily Introscope.
  • What is the workload model and identifying the workload model?
  • SLA of the application in terms of response times and hardware resource utilization.
Have you prepared Test Plan/Test Strategy?

Yes.

What are the contents in your Test Plan/Test Strategy?

It's always better to go through the test plan before the interview, it helps a lot. Some of the Test Strategy contents are Introduction, Purpose of The Document, Scope Of The Document, Application Architecture And Topology, Performance Testing Requirements And Dependencies, Objectives And Goals Of Performance Testing, Scope Of Performance Testing, In Scope, Out Of Scope, Application Performance Scenarios, Workload Characteristics, Application Test Environment, Performance Test Tools, Performance Test Dependencies, Hardware Dependency, Software Dependency etc.

What is little’s law?

please go through this link for little's law 
http://en.wikipedia.org/wiki/Little's_law

Tell me some of the performance testing tools that you use in your company?

Loadrunner, Jmeter, Sitescope, HP Diagnostics, Wily Introscope, Dynatrace and Java Profiler.

What is performance tuning?

Performance tuning is done during the process of performance testing. Issues will be identified during the different types of performance testing. Performance tuning will be done based on the issues. It might be a software / hardware tuning. Usually Bottlenecks are identified in application and database servers. Proper tuning of the servers, code and SQL queries resolves the issue. Sometimes changes in the hardware resources will also help. 

What is the difference type of tests you conducted during testing?

Load Testing, Stress Testing, Failover Testing etc.


Loadrunner General Questions:
What is Loadrunner?

Loadrunner is a performance testing tool. It is developed by Mercury and acquired HP. It has versions Loadrunner 7 to Loadrunner 12.

What are the Loadrunner components? 

Vugen, Controller, Load Generators, Analysis, Shunra.

What are the Loadrunner versions used?

Loadrunner 9.52, Loadrunner 11.3, and Loadrunner 11.5 and Loadrunner 11.52.

Vugen and Scripting Questions:

How do you start the script?

We usually start the scripting after understanding of Business Critical Scenarios.

What are the various functions you have used while creating the scripts?

You should able to tell at least 10 loadrunner functions and different functions that you have used in different protocols. 

What is Step download timeout error? 

If the application does not respond in 120 seconds, step download timeout occurs in loadrunner. We can increase the step download timeout error in Loadrunner (Runtime Settings -> Preferences -> Options -> General -> Step Download Timeout.

What are the different type of parameters available?

Custom, Date/Time,File, Group Name, Iternation Number, Load Generator Name, Random Number, Table, Unique Number, User Defined Function and Vuser ID.

What is advanced trace?

It logs all the vuser messages and function calls.

What are the Logs available in LR?

Code Generation, Replay Log

What are the protocols you worked on?

Tell the protocols that you know and explain how good you are in that protocols.

Difference between Think Time & Pacing?
  • Think is time interval between two transactions.
  • Pacing is the time interval between two iterations.
What is Parameterization & Correlation?
  • Parameterization is giving the input through a parameter file in loadrunner.
  • Correlation capturing a required value from the server response in loadrunner. Example: SessionID.
How do you run specific part of your script for a specified number of times?

We can run the specific part of the script by using blocks in run time settings -> General -> Run Logic.

What are different recording modes available in LR?

We have mainly two recording modes HTML mode and URL mode.

What are the advanced features of URL recording mode in LR 9.5?
We have mainly two features:
  • Create concurrent groups for resources after their source HTML page.
  • Use web_custom_request only.
What is the difference between resource=0 and resource=1?

For example www.msn.com has many resources like images, JavaScript etc.
Here www.msn.com Resource is 0 as it is the main URL and the corresponding resources like image resource is 1.

What is the difference between lr_abort and lr_exit?

Lr_abort: it stops the execution of the action part and executed the vuser_end section.
Lr_exit: it exits from the particular action, script or iteration and there are different options with lr_exit;
Example:
lr_exit (LR_EXIT_VUSER, LR_FAIL);
lr_exit (LR_EXIT_ACTION_AND_CONTINUE, LR_FAIL);

What is the difference between lr_eval_string and lr_save_string?

Lr_eval_string: It extracts a value from a given parameter.
Lr_save_string: It saves c variable into loadrunner variable.

What is context less and context based?

Context less mean the request does not depend on the previous request. Context based means the request is dependent on the previous request.

What is the use of Save Count in web_reg_find?

Number of times the given text has found in a particular page.

What is Correlation and its function with attributes?

Capturing a value from the server response. The function name is web_reg_save_param. List of attributes are Step Name, ParameterName, LeftBoundary, RightBoundary, ORD, NotFound = Warning/Error, Savelen, Saveoffset.

How do you do auto correlation?

From Loadrunner 11.5 we have a beautiful option called Design Studio. The loadrunner will detect the dynamic values and we can do the correlation easily.

If source is not available, then how do you do correlation?

We have different option to do correlation, Generation Log, Replay Log.

Difference between “Save Offset” & “ Save Length” and what are test flags?

Save offset is used to ignore the number of letters and Save Length is used to save the length of the parameter.

When do you use Web_Custom_request?

The name of the function itself indicates the custom request. Web_custom_request is the last option that vugen prefer during creation of the script. It first tries to create the script using different web functions. This function is used by the vugen when it cannot interpret the requests with the other web functions. 

Dynamically the post data is changing, what do you do?

In this situation, I will use web_custom_request and use the for loop to append the dynamically changing data to web_custom_request.

What are check point available in LR?

web_find, web_reg_find, web_image_check.

Do you write any user defined functions?

Make sure you prepare well for this question.

What are the run time settings you have used in your script?

We use the run time settings based on our requirements. Iteration, Run Logic, pacing thinktime etc.

What are the challenges you have faced during script generation & execution?

Prepare well for this question, you should be able to answer the question clearly.


What is the difference between get and post request?

Get Request
Post Request
We can use up to 2048 character length.
It has no restrictions
Get request is less secure.
Post request is secure.
It can be cached
It cannot be cached.
It can be bookmarked
It can not be bookmarked.

What is the difference between web_url and web_link?
web_url:
  • It's a GET request
  • The web_url function does not require a context
  • web_url is recorded only when VuGen is in either URL–based recording or in HTML–based recording mode.
web_link:
  • web_link function is an action function that emulates a mouse click on the link that is defined by the attributes.
  • The web_link function can be executed only in the context of a previous operation.
  • web_link is recorded only when VuGen is in HTML-based recording mode.
What is the difference between web_submit_data and web_submit_form?

Web_submit_form
Web_submit_data
It is a context based submission
It is a context less submission
It is recorded only html based
It is recorded both in html and url mode.

What is the difference between web_submit_data and web_custom_request?

Web_submit_data
Web_custom_request
It is a context less submission
It is also context less submission.
We cannot write a custom request.
We can write a custom request using this function.
We can send through get or post request
We can send only post request

What is the difference between web_find and web_reg_find?

Web_find deprecated and we have only web_reg_find now.

What is the difference between lr_output_message and lr_error_message?

Lr_output_message
Lr_error_message
The lr_output_message sends message to the output window, log files (such as the Vaughan log file and the Application Management Web site and agent log file), and other test report summaries. When a script is run in VuGen, the output file is output.txt.
The lr_error_message function sends an error message to product output windows (such as the LoadRunner output window), log files (such as Vugen and the Application Management agent log file), and other test report summaries. For details regarding the output for each product, see the product's user guides.
If Run-time settings > General > Miscellaneous > Fail open transactions on lr_error_message is selected, calling lr_error_message will fail the transaction in addition to sending the message
To send a message to the output file, you must enable logging in the run-time settings, and select Always send messages. If you select Send messages only when an error occurs, there is no output from this function.
VuGen displays the message text of the lr_error_message function in the Execution log in red, using Error code 17999. Note that this function sends a message to the output even when logging is disabled in the run-time settings.

Controller and Analysis Interview Questions and Answers:

Difference between Scenario & Group, Real world Schedule & Basic Schedule?


Difference between Performance Center & Controller?

HP Loadrunner
HP Performance Center
It is a standalone application
It is a web based application.
Only single load test is executed at a time.
Here we can execute multiple load tests.
We cannot trace the requirements and defects
Here we can trace the requirements and defects
We cannot reserve time slots for machines
Here we can use timeslots to reserve the machines
Loadrunner is good if we are using from one location.
Performance Center is good if we are operating from different locations.

How do you come to know which Vuser failed?

We can check in the vuser status message.

What is Rendezvous point?

When lr_rendezvous function is called, all the users wait at that point and executes the next step.

What is IP Spoofer in loadrunner?

We can create the IP addresses dynamically using IP Spoofer.

Can you configure load generators in Windows & Unix?

Yes, we can configure the load generators in both Windows and Unix.

Can we run different scripts by using Performance Center and the Controller?

Yes, we can run.
Analysis
What are the default counters that loadrunner analysis file shows?

Vusers, Hits Per Second, Throughput, Average Transaction Response Time, Transactions per second.

What are the Operating Systems counters you monitor?

CPU, Memory, Disk, Network

Give me 5 server counters that you regularly check?

Response times, throughput, hits per second, CPU, Memory, Heap Memory.

What AWR Reports? From which version of the Oracle – AWR feature is added?

AWR stands for Automatic workload Repository. It is introduced from Oracle 10g.

What is Granularity?

Granularity is the time interval of sampling the data in loadrunner analysis.

Difference between Thread & Process?

Thread
Process
Threads are dependent on each other in a process
Process are independent of each other
Threads uses very less resources
Process uses very high resources
Threads shares the address space
Process requires a separate address space
Threads carry very less information when compared with process.
Process carry more information

What is JVM & Unix?

JVM stands for Java Virtual Machine which is a platform independent and converts Java byte code to machine language. As it is platform independent we can execute the code on any operating systems.

Unix is a multiuser operating system and has many flavors like Linux, Sun Solaris, AIX, HP Unix, Ubuntu etc.

What is Memory Leakage?


What is Garbage Collection?


What are the algorithms available in GC?


What is Heap memory?


How do you monitor server counters?

We use Sitescope or NMON tool and different commands available in Linux VMSTAT, IOSTAT, TOP etc.

What is Table Scanning?

When there are no Proper indexes given in the database tables, some queries will scan the entire data in the tables and collect the results which will increase the response time.

What are context switches?


What is a deadlock?

Deadlock occurs when two or more processes/threads waiting for the other to finish and it never happens and this leads to deadlock.  This situation will apply to hardware/software, Java and databases.

What do you suggest to your client if there is a sudden hike in the CPU utilization while execution?

Sudden hike in the CPU utilization might have many reasons. We need to analyze what caused the high CPU utilization by using different tools and profilers.

What is Parsing, Soft Parse, and Hard Parse?

Parsing: It will check the syntax, misspelled SQL keywords and authentication.

Soft Parse:  If the requested query is found in shared pool soft parsing occurs and it consumes less resources.

Hard Parse:  If the requested query is not found in shared pool hard parsing occurs and it consumes very high resources.

What is the difference between Web Server, Application Server and Database Server?

Web Server
Application Server
Database Server
Ex: Apache, IIS and Nginx
Weblogic and Websphere
Oracle, My SQL,  and SQL server
It handles HTTP requests.
It handles HTTP requests and it contains business logic.
It handles different queries, and records.
Resource utilization is low.
Resource utilization is high.
Resource utilization is high.

What is standard deviation in loadrunner?

Standard deviation in loadrunner is done with the total response times of a particular transaction.
For example, if you ran a transaction for 10 iterations. It will take the 10 transaction response times and calculates the Standard Deviation. If the standard deviation between these 10 values is high. Then it is a bottleneck, it should always low.
Examples:
Response times for login page with 5 iterations ->1, 1, 1, 1, 1=Standard Deviation is 0
Response times for a logout page with 5 iterations 1, 2, 3, 4, 5, 6=Standard Deviation is 2.5 which is high.

Is there any impact if we reduce “Think Time” up to 50%?

Yes, there will be impact as the load on the server increases if we decrease think time. Mainly we have an impact on response times, throughput and system resources etc.

At Last......

Every option in the Vugen, Controller and Analysis are important. The interviewer might ask any question on the tool. We should prepare for the interview in such a manner.  Please go through the following settings once before you go for the interview.
  • Run time settings
  • Recording Options
  • Controller Options
The main challenge in the interview will be questions on Analysis. You should prepare well for these topics in order to crack the interview.
Read More

lr_set_debug_message function in loadrunner with examples

//
Lr_set_debug_message – One of my favorite lr function in loadrunner. It is mainly useful when we are unable to find correlation value in a particular request.

We usually use Extended log -> Data Returned by Server in Run-time Settings to get all the response in replay log. Sometimes the vugen will crash or becomes slow as the vugen is writing all the response to replay log.

Extended Log in Run-time Settings
Extended Log in Run-time Settings
If it crashes or taking long time to execute the script then it’s better to use lr_set_debug_message instead of using Data Returned by Server.

In the following example we have added data returned by server only to particular request.

Example:

lr_set_debug_message (LR_MSG_CLASS_EXTENDED_LOG | LR_MSG_CLASS_FULL_TRACE, LR_SWITCH_ON);
        web_url("Bing",
        "URL=http://www.bing.com/",
        "Mode=HTML",
        LAST );
lr_set_debug_message (LR_MSG_CLASS_EXTENDED_LOG | LR_MSG_CLASS_FULL_TRACELR_SWITCH_OFF);


lr_set_debug_message can also be written in the following way:

Declare in globals the following way and call wherever required.


#ifndef _GLOBALS_H
#define _GLOBALS_H
//--------------------------------------------------------------------
//Include Files
 #include "lrun.h"
#include "web_api.h"
#include "lrw_custom_body.h"
//Global Variables
Extended_Log_On()
{
lr_set_debug_message (LR_MSG_CLASS_EXTENDED_LOG | LR_MSG_CLASS_FULL_TRACELR_SWITCH_ON);
return 0;
}
Extended_Log_Off()
{
lr_set_debug_message (LR_MSG_CLASS_EXTENDED_LOG | LR_MSG_CLASS_FULL_TRACELR_SWITCH_OFF);
return 0;
}
#endif // _GLOBALS_H

Action Part Started Here:

Action()
{
    Extended_Log_On();
       web_url("Bing",
        "URL=http://news.google.com/",
        "Mode=HTML",
        LAST );
     Extended_Log_On();
     return 0;
}

There are mainly three setting for message logging. The second table is used to further refine the message logging.

Log LevelC LanguageConstantsValue
DisabledLR_MSG_CLASS_DISABLE_LOG0
BriefLR_MSG_CLASS_BRIEF_LOG1
Extended Log LR_MSG_CLASS_EXTENDED_LOG16

Log LevelC Language ConstantsValue
Result DataLR_MSG_CLASS_RESULT_DATA2
Parameter SubstitutionLR_MSG_CLASS_PARAMETERS4
Full Run-Time Trace LR_MSG_CLASS_FULL_TRACE 8
Read More