21
Infotek Solutions Inc. Correlation in LoadRunner When client communicate with server to do some process, a meeting will start between client and server. Client requests to server and Server response client’s request. That meeting is called Session. In meeting, to remember the person, name will help for that. Same thing is in Loadrunner. Client send request to server and session will start. In many web application like Gmail, Facebook etc. when you login to them, a session starts which helps to do further process. Same thing happens in HP Web Tour Application. There also one session starts when you login to HP Web Tour Application. This session helps to book the flight. That is a correlation. In Loadrunner , there are two types of correlation in Loadrunner 1. Manual 2. Automatic There are three ways to correlate in Loadrunner 1. Web_reg_save_param 2. Web_create_html_param_ex Now we see how to correlate in Loadrunner. Please check that your web server is on running condition or not. If not, please run web server. Follow the steps to correlate in Loadrunner. In this tutorial we will see manual Correlate where we use Web_reg_save_param_ex with hard coded. Prerequisite: Should be Knowledge of recording of script. Recorded script which is successfully run. Perform same operation what you recorded before. For example you have recorded script_1. You have to perform same actions in this script too. I am using same actions what I performed in my last tutorial(Record flight reservation and replay it).

Infotek Solutions Inc. Correlation in LoadRunner · Infotek Solutions Inc. Correlation in LoadRunner When client communicate with server to do some process, a meeting will start between

  • Upload
    vubao

  • View
    215

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Infotek Solutions Inc. Correlation in LoadRunner · Infotek Solutions Inc. Correlation in LoadRunner When client communicate with server to do some process, a meeting will start between

Infotek Solutions Inc.

Correlation in LoadRunner

When client communicate with server to do some process, a meeting will start between client

and server. Client requests to server and Server response client’s request. That meeting is

called Session. In meeting, to remember the person, name will help for that. Same thing is in

Loadrunner. Client send request to server and session will start. In many web application like

Gmail, Facebook etc. when you login to them, a session starts which helps to do further

process. Same thing happens in HP Web Tour Application. There also one session starts when

you login to HP Web Tour Application. This session helps to book the flight. That is a

correlation.

In Loadrunner , there are two types of correlation in Loadrunner

1. Manual

2. Automatic

There are three ways to correlate in Loadrunner

1. Web_reg_save_param

2. Web_create_html_param_ex

Now we see how to correlate in Loadrunner.

Please check that your web server is on running condition or not. If not, please run web

server.

Follow the steps to correlate in Loadrunner. In this tutorial we will see manual Correlate

where we use Web_reg_save_param_ex with hard coded.

Prerequisite:

Should be Knowledge of recording of script.

Recorded script which is successfully run.

Perform same operation what you recorded before. For example you have

recorded script_1. You have to perform same actions in this script too. I am

using same actions what I performed in my last tutorial(Record flight

reservation and replay it).

Page 2: Infotek Solutions Inc. Correlation in LoadRunner · Infotek Solutions Inc. Correlation in LoadRunner When client communicate with server to do some process, a meeting will start between

We will see manual Correlation.

1. Go to administration page of HP Web Tour application

Check the checkbox of “Set Login form’s action tag to an error page”. Look at the above

snapshot. Now click on update button to update administration setting. Look at the below

snapshot.

2. Go to file menu ->New script and solution. Click on that New script and solution.

Page 3: Infotek Solutions Inc. Correlation in LoadRunner · Infotek Solutions Inc. Correlation in LoadRunner When client communicate with server to do some process, a meeting will start between

3. A pop up window will appear where you can choose Script.

Choose Web- HTTP/HTML protocol and give the name to that script and click on create

button.

4. After click on create button, Web- HTTP/HTML protocol script will generate

Look at the left hand side, there are actions of that scripts

Page 4: Infotek Solutions Inc. Correlation in LoadRunner · Infotek Solutions Inc. Correlation in LoadRunner When client communicate with server to do some process, a meeting will start between

5. go to record menu->record. After click on record, a pop up window will appear

where you can set record into action, browser, url address, recording setting. Look

at the below image

Please set record into action as Action by list and set URL address

http://127.0.0.1/WebTours/index.html, this is home page of HP flight Web Tour

and click on start recording.

6. After click on start Recoding and recording will start. A web browser will open and a

record window will open. Look at below images ..

7. In home page, input the username and password, what you used in signup page.

Page 5: Infotek Solutions Inc. Correlation in LoadRunner · Infotek Solutions Inc. Correlation in LoadRunner When client communicate with server to do some process, a meeting will start between

8. After login, you will go to welcome page. After click on home flight button which is

left hand side.

9. After click on flight button, you will go to find flights

Page 6: Infotek Solutions Inc. Correlation in LoadRunner · Infotek Solutions Inc. Correlation in LoadRunner When client communicate with server to do some process, a meeting will start between

Choose arrival city, seating preference and Type of Seat in this webpage and continue.

Page 7: Infotek Solutions Inc. Correlation in LoadRunner · Infotek Solutions Inc. Correlation in LoadRunner When client communicate with server to do some process, a meeting will start between

10. After click on continue , you will go to choose the flight and recording will continue.

choose a flight and click on continue button.

11. You will go final step where you will input the card number and expire date and click

on continue.

Page 8: Infotek Solutions Inc. Correlation in LoadRunner · Infotek Solutions Inc. Correlation in LoadRunner When client communicate with server to do some process, a meeting will start between

12. Now you have booked one flight. Now click on Itinerary button to see the booked

flight.

13. After click on Itinerary button, you can see booked flight, if you have booked other

flights before the recording. Those will also in the list.

Page 9: Infotek Solutions Inc. Correlation in LoadRunner · Infotek Solutions Inc. Correlation in LoadRunner When client communicate with server to do some process, a meeting will start between

Now click on Sign off button and stop the recording.

14. If you get below snapshot, please close that window

Page 10: Infotek Solutions Inc. Correlation in LoadRunner · Infotek Solutions Inc. Correlation in LoadRunner When client communicate with server to do some process, a meeting will start between

15. After stop the recording you will see script in Action script what you chose before the

recording.

16. Now it is time to run. Go to Replay->Run or Press F5. After replay recorded scripts

you will get error.

Page 11: Infotek Solutions Inc. Correlation in LoadRunner · Infotek Solutions Inc. Correlation in LoadRunner When client communicate with server to do some process, a meeting will start between

Script failed why? What is the reason? what parameter is cause of failed script. The

parameter is Session. How? Let explain this at the time of login, I session id

generated. That session id is recorded and use as parameter. Look at the below

snapshot web_submit_data() function has userSession parameter.

.

When we run this script, at the time new userSession generated, but we supply old

userSession which used at time to recording. That’s why Script is failed. userSession did not

match. So, client did not communicate with server for further request with server and script

failed. Now it is time to correlate with server and establish communication client and server

with dynamic userSession value.

17. For more information will be compare failed script with existing script which has

recorded already and run successful. For me, successful run script is WebHttpHTML4

and failed script is WebHttpHTML6. Now we have to compare WebHttpHTML6’s

action.c file with WebHttpHTML4’s action.c. go to WebHttpHTML6’s action.c

18. Go to tools->compare->compare to external file

Page 12: Infotek Solutions Inc. Correlation in LoadRunner · Infotek Solutions Inc. Correlation in LoadRunner When client communicate with server to do some process, a meeting will start between

Choose WebHttpHTML4’s action.c . Now wdiff.exe will appear.

Page 13: Infotek Solutions Inc. Correlation in LoadRunner · Infotek Solutions Inc. Correlation in LoadRunner When client communicate with server to do some process, a meeting will start between

Above snapshot is wdiff.exe. You can see yellow color on different line and function. It

indicates the difference between two scripts WebHttpHTML4’s action.c(right side) and

WebHttpHTML6’s action.c(left side)

Now see web_submit_data function of both scripts

web_submit_data Of WebHttpHTML6’s action.c(left side) has userSession and its value. On

other side WebHttpHTML6’s action.c(right side) does not has userSession. Rest differences

do not affect.

19. Now we have to change the Run setting. Double click on run setting which is in

Solution Explorer

A pop up window will appear. Go to Log option and choose Extended log(right hand

side) and check all three options under Extends log (right hand side)

Page 14: Infotek Solutions Inc. Correlation in LoadRunner · Infotek Solutions Inc. Correlation in LoadRunner When client communicate with server to do some process, a meeting will start between

After this click on OK button and Replay the script. You will get error again.

20. Click on Replay log link

Page 15: Infotek Solutions Inc. Correlation in LoadRunner · Infotek Solutions Inc. Correlation in LoadRunner When client communicate with server to do some process, a meeting will start between

Go to output screen. If you can not see output. Go to view menu->output. In output screen

press control + F and find userSession.

You will see “action=error.pl” above step of userSession in output screen

Page 16: Infotek Solutions Inc. Correlation in LoadRunner · Infotek Solutions Inc. Correlation in LoadRunner When client communicate with server to do some process, a meeting will start between

This indicates that userSession is cause of script failed. To Solution, we will use parameter

instead of hard coded value in userSession. How ? Ans : continue the process…

21. Double click on userSession statement in output screen this will reflect you script

editor and indicate the function where this statement belongs.

After double click on userSession statement cursor will go web_url() function in action

script.

22. Now it is time to see the server response of web_url() function in snapshot.

23. Go to snapshot, if you can not see go to view menu ->snapshot. In snapshot(cursor

will be on web_url() in script editor). Go to tree view in snapshot and click on

Response Body. Check out below snapshots..

Page 17: Infotek Solutions Inc. Correlation in LoadRunner · Infotek Solutions Inc. Correlation in LoadRunner When client communicate with server to do some process, a meeting will start between

Go to /cgi-bin/nav.pl?in=home on left side of Tree view.

Search userSession statement in Response Body

Page 18: Infotek Solutions Inc. Correlation in LoadRunner · Infotek Solutions Inc. Correlation in LoadRunner When client communicate with server to do some process, a meeting will start between

Now select userSession value only in Response Body not full statement

and right click, select create Parameter.

24. After click on Create parameter, a pop up window will open of Parameter, give the

name of parameter. See below snapshot

Page 19: Infotek Solutions Inc. Correlation in LoadRunner · Infotek Solutions Inc. Correlation in LoadRunner When client communicate with server to do some process, a meeting will start between

You can see Left Boundary and Right Boundary, these will use in parameter function.

Click on OK button. Parameter function will add top of action script.

25. Now change the userSession value into Parameter name. copy parameter name, look

at the snapshot parameter name is CorrelationParameter, copy this name and search

userSession in script editor and change the value of userSession with {

CorrelationParameter } , do not remove curly braces. Look below snapshots

Page 20: Infotek Solutions Inc. Correlation in LoadRunner · Infotek Solutions Inc. Correlation in LoadRunner When client communicate with server to do some process, a meeting will start between

now save the script.

This time script will run successfully. Some snapshots are below.

Page 21: Infotek Solutions Inc. Correlation in LoadRunner · Infotek Solutions Inc. Correlation in LoadRunner When client communicate with server to do some process, a meeting will start between