Correlation is a process to capture dynamic values and pass
them at appropriate places in the script on run time.
E.g. There are situations when a request is based on a response
of previous request received from the server, such as, a Session ID, server
date/time which is fetched from server. Depending upon the configuration of the
servers, these values changes (it might change every time you run the
application, after certain time, hour, day etc.). Obviously, if the execution
of script depends upon a value returned by server, it means we need to find a way
where we can “catch” the server response and replace those values in the
requests where it is required. This whole process is called Correlation in
Loadrunner.
In simple words, the solution by using Correlation is:
1. Capture response of previous step
2. Use captured value of step 1 to serve as input to all
subsequent steps
Loadrunner provides 2 ways for doing correlation.
1. Automatic Correlation
Loadrunner has provided a
mechanism by which we it will automatically capture the dynamic values.
Below are the steps for Automatic
correlation
a.
Rules Scan
b.
Automatically correlate values found – If you
check this option then vugen will not ask for correlation, it will
automatically correlate the dynamic values for the defined rules.
c.
Record Scan
d.
Replay Scan
IV.
Click on Rules (Correlation à Rules)
In this window you can choose the application you are recording. Loadrunner has provided some predefined rules for various applications.
You can create new rules for your
application if you know left and right boundaries. We will take this topic in
my next article.
V. Click Ok. If you have already recorded the
application then click on regenerate the script. It will replace all the
dynamic values which are identified by defined rules.
Note. We can do the same process
of automatic correlation before recording the script, then we don’t need to
regenerate the script.
2. Manual Correlation
In this we directly identify the
dynamic value and write code in the script
Below are the steps for doing
manual correlation:
I.
Find the dynamic value which is required to correlate.
II.
Find unique left and right boundaries of where
dynamic value is coming from the server.
III.
If unique left and right boundaries can’t be
found then find for which occurrence of left and right boundary this dynamic
value is coming.
IV.
Add a web_reg_save_param function to the script,
above the request whose response contains that dynamic value.
V.
Add a parameter name, left boundary, right
boundary, and occurrence to the function
VI.
Replace the dynamic value with this parameter in
the script every time it occurs.
No comments:
Post a Comment