LoadRunner - Basic Questions 1

Difference between lr_exit() and lr_abort()?

lr_exit(): 

  • lr_exit(LR_EXIT_ACTION_AND_CONTINUE, LR_AUTO); Exit without any condition, and go directly to end action
  • lr_exit(LR_EXIT_MAIN_ITERATION_AND_CONTINUE, LR_AUTO);Stop current action, and go to the next action
  • lr_exit(LR_EXIT_ITERATION_AND_CONTINUE, LR_AUTO); Stop current iteration, and go to the next iteration. If called from within a block iteration, only the block iteration will be exited, and not the global iteration
  • lr_exit(LR_EXIT_VUSER_AFTER_ITERATION, LR_AUTO); Run until the end of the current iteration and then exit
  • lr_exit(LR_EXIT_VUSER_AFTER_ACTION, LR_AUTO); Run until the end of the current action and then exit


lr_abort():
The lr_abort function is used to abort the execution of a Vuser script. 
It instructs the Vuser to stop executing the Actions section, execute the vuser_end section and end the execution

How to set correlation rules?

Pre-requisite:  You know the left and right boundary for the session ID

Step 1: Open the recording option -> Correlation -> Check "Enable correlation during recording"
Step 2: Click on New Application and enter the name of the application. 
Step 3: Select the application in the left panel and Click on New Rule. Then enter the rule name "Session ID". In the right hand side, you need to update the left and right boundary value. Also provide the correlation variable name. For example "Param_SessionID".
Step 4: Click on Advance button. Check "Replace with parameter only for exact parameter". Then click on OK.
Step 5: Start recording the business flow. Once the recording is done, check the script. 

VuGen automatically done the correlation for Session ID and replaces all the occurrences.

Difference between Application and Web server?

1. Application Server supports distributed transaction and EJB. While Web Server only supports Servlets and JSP.
2. Application Server can contain web server in them. most of App server e.g. JBoss or WAS has Servlet and JSP container.
3. Though its not limited to Application Server but they used to provide services like Connection pooling, Transaction management, messaging, clustering, load balancing and persistence. Now Apache tomcat also provides connection pooling.
4. In terms of logical difference between web server and application server. web server is supposed to provide http protocol level service while application server provides support to web service and expose business level service e.g. EJB.
5. Application server are more heavy than web server in terms of resource utilization.

Example: Apache Tomcat HTTP Server is Web Server and Oracle WebLogic is Application Server.

What is and does Standard deviation indicates?

The Standard Deviation is a measure of how response time is spread out around the Mean. Simply say, the smaller the Standard Deviation, the more consistent the response time.

Scripting REST API in LoadRunner

With example for bot GET and POST

GET:

You will have a URL with all variables in it.
Test it manually in SOAP UI
Try to observe the difference in passed and failed transaction to add conditon in LR script

In Load Runner:

Take Protocol as Web HTTP/HTML
Get web_custom_request from View - Step Tool Box.
Put URL and Click OK.
Parameterize the variable in URL

web_reg_save_param("c_response","LB=","RB=",LAST);

    web_reg_save_param("c_employeeName","LB=\"employee_name\":\"","RB=\",\"",LAST);
   
    lr_start_transaction("Start_transaction_1");

    web_custom_request("web_custom_request",

        "URL=http://dummy.restapiexample.com/api/v1/employee/{p_EmployeeId}",
        "Method=GET",
        "TargetFrame=",
        "Resource=0",
        "Referer=",
        "Body=",
        LAST);
lr_end_transaction("Start_transaction_1"LR_AUTO);


POST:
You will have a URL with all variables in it.
Test it manually in SOAP UI
Try to observe the difference in passed and failed transaction to add conditon in LR script

In Load Runner:

Take Protocol as Web HTTP/HTML
Get web_custom_request from View - Step Tool Box.
Put URL, request and convert it in C format bt right click option
Parameterize the input variables

web_reg_save_param("c_full","LB=","RB=",LAST);

    web_reg_save_param("c_id","LB=\"id\":\"","RB=\"}",LAST);
   
    lr_start_transaction("POST_Transaction");
    web_custom_request("web_custom_request",
        "URL=http://dummy.restapiexample.com/api/v1/create",
        "Method=POST",
        "TargetFrame=",
        "Resource=0",
        "Referer=",
        "Body={\"name\":\"{p_name}\",\"salary\":\"{p_salary}\",\"age\":\"{p_age}\"}",
        LAST);
    lr_end_transaction("POST_Transaction"LR_AUTO);

Data Source and DB connection

How to check Data source:

Login to weblogic console. In Domain structure tree, Go to Services, then select Data Sources,
On the Summary of Data Sources page, click the data source name.
Select the Monitoring: Statistics tab.
Statistics are displayed for each deployed instance of the data source.

How to check Database connection:

YOu need to have db permission to access below query:
select sid, serial#, osuser, machine, program, module from v$session;
SELECT SID, Serial#, UserName, Status, SchemaName, Logon_Time FROM V$Session WHERE Status='ACTIVE' AND UserName IS NOT NULL;

History Table:
v$active_session_history