Vous êtes sur la page 1sur 27

Loadrunner questions:

1.Regular expressions

Do you have a correlation which you can’t solve because the values of the left and right boundary are
dynamic? Correlation is an essential part of performance test scripting and there are plenty of different
challenges with correlation. Imagine having a value of “GraphA123567EndGraphA” and the goal is to
correlate 123567

From the example above, the left and right boundaries would be “LB=GraphA” “RB=EndGraphA”
What if the word GraphA is dynamic and can be anything from GraphA-GraphZ?

There is a solution at hand!

Using web_reg_save_param_regex will allow the user to grab a correlation value using dynamic left and right
boundaries. This function uses the power of regular expressions, below are a few examples:

Example 1:
Source: “GraphA123567EndGraphA”
Solution: web_reg_save_param_regexp(“ParamName=CorrValue”, “RegExp=\“Graph[A-Za-z]\”, \“([0-9]+)\”,
\“EndGraph[A-Za-z]\””, LAST);
Result: 123567

Example 2:
Correlate the values from a drop down list of a form
Source: dropdown >>> red, blue, green
Solution: web_reg_save_param_regexp(“ParamName=ColourList”, “RegExp=option=[0-9]+>([A-Za-z])gc

 {ColourList1}=red
 {ColourList2}=blue
 {ColourList3}=green

Example 3:
Correlate up till the end of 642
Source: J\u002blsGd3zj1qdP\u002bvk0vDRaKyJFde5tCa6spDEy08SNab1hP8j5GTs4j6\u002f\u002bTqOwvx
MHEQZLWd\u002btu8NlHJrVAarIQ==|634998513832503642″];
Solution: web_reg_save_param_regexp(“ParamName=SecurityString”,”RegExp=\”([A-Z0-9a-z\\\\+]+==\\|[0-
9]+)\”\\];”,LAST);
Result:J\u002blsGd3zj1qdP\u002bvk0vDRaKyJFde5tCa6spDEy08SNab1hP8j5GTs4j6\u002f\u002bTqOwvx
MHEQZLWd\u002btu8NlHJrVAarIQ==|634998513832503642

Example 4:
Correlate only “634998513832503642” Source:

J\u002blsGd3zj1qdP\u002bvk0vDRaKyJFde5tCa6spDEy08SNab1hP8j5GTs4j6\u002f\u002bTqOwvxMHEQZ
LWd\u002btu8NlHJrVAarIQ==|634998513832503642"];

Solution:
web_reg_save_param_regexp("ParamName=SecurityString",
"RegExp=\"[A-Z0-9a-z\\\\+]+==\\|([0-9]+)\"\\];",
LAST);

Result: 634998513832503642

So what is a Regular Expression?


Also known as regex, a regular expression is a search string which enables matching of a string. Think of it as
an advance searching function which can pick out values from a string of multiple characters.

Examples of regex:

 \d matches a single digit


 \w matches a single word (including alphanumeric characters and underscore)
 [A-Z]+ matches any word which is upper case
 [a-z]+ matches any word which is lower case
 [0-9]+ matches any numeric value

There are other alternatives to web_reg_save_param_regexp. However these functions are limited and not as
flexible.

LB/DIG RB/DIG – # will be a wildcard for a numeric value“session_id_##”

 Adding LB/IC/DIG will ignore case


 “LB/IC/DIG=session_id_##=” (e.g. Session_id_20)

LB/ALNUM or RB/ALNUM – ^ will be a wildcard for an alphanumeric value

 ALNUMIC – ignore case


 ALNUMLC – match only lower case
 ALNUMUC – match only upper case

SaveOffSet

 If there is a dynamic value for a boundary e.g. “session_id_2” (3,4,5)


 SaveOffSet = 2 (to cover “2=”)
 Web_reg_save_param(“SessionID”, “LB=session_id_”, “RB=\””, “SaveOffSet=2”, LAST);

LR implementation

 PERL based
 LR 11 does not support multiple capture groups however this is now supported in LR 11.52 (example
below)

Example Multiple Capture Groups


Source:
rows”:[[“NW,RO,RA”,”DLY”,”10/07/2011″,”10/17/2011″,”10/01/2011″,”RA”,”Y”,”FR”,”AMEA”,”AC”,”19
45″,”50″,”50″,”AC 100IOSH-08″,”UserDefined”,”10/07/2011″,”Reassigned”…”
Solution: web_reg_save_param_regexp(“ParamName=ParamValue”,”RegExp=rows”:\[\[“[^”\r\n]*”,”([A-
Z]{3})”,”[^”\r\n]*”,”[^”\r\n]*”,”[^\/]+\/[\d]+?\/2011″,”[A-Za-
z]*”,”[^”\r\n]*”,”[^”\r\n]*”,”([^”\r\n]*)”,”[^”\r\n]*”,”([^”\r\n]*)”,LAST);

Result:

 {ParamValue1} = DLY
 {ParamValue2} = AMEA
 {ParamValue3} = 1945

Tags: correlation, LoadRunner, regular expressions, VuGen

11 comments

vijayaprasad Dilli
February 2, 2018 Reply

(input type=”hidden” name=”.*?3b0a0a4a1a1a\db3-h)

Could you please help me in representing the above regex (valid when tried from reg ex tools) in loadrunner. I
tried the below but does not match. I just need the count of the matches. Please note.\d is a unique digit in the
expression and need to be

web_reg_save_param_regexp(
“ParamName=Correlation3”,
“RegExp=(input type=\”hidden” name=.*?3b0a0a4a1a1a\db3-h) ”
“Ordinal=All”,
// “NotFound=Warning”,
SEARCH_FILTERS,
“Scope=Body”,
LAST );

Thank you much in advance

Lionel
February 5, 2018 Reply

Hi,

Can you escape the \d with \\d

You also should revisit the capture group because at the moment you are capturing everything from the word
“input” till the last character of the name value
Leo
June 7, 2017 Reply

I followed the blog and created a regular expression with multiple capturing groups.However I cant use the
variables the way you showed.(ie {Param1} {Param2} etc)

govardhan
June 13, 2016 Reply

Hi Expert,
In Example Multiple Capture Groups :
Source:
rows”:[[“NW,RO,RA”,”DLY”,”10/07/2011″,”10/17/2011″,”10/01/2011″,”RA”,”Y”,”FR”,”AMEA”,”AC”,”19
45″,”50″,”50″,”AC 100IOSH-08″,”UserDefined”,”10/07/2011″,”Reassigned”…”
and Regularexperssion you wrote as below
Solution: web_reg_save_param_regexp(“ParamName=ParamValue”,”RegExp=rows”:\[\[“[^”\r\n]*”,”([A-
Z]{3})”,”[^”\r\n]*”,”[^”\r\n]*”,”[^\/]+\/[\d]+?\/2011″,”[A-Za-
z]*”,”[^”\r\n]*”,”[^”\r\n]*”,”([^”\r\n]*)”,”[^”\r\n]*”,”([^”\r\n]*)”,LAST);

__ I have few questions __


1. you had used \r\n in above regexp, but is for new lines . as per the source code in single line.
2. ^” is for match any thing expect in regexp and * is for match from Zero (0) to all.

Sree Mereddy
January 22, 2016 Reply

Hi

I am trying to capture a value between ;90004; and ” style=


90004 keeps changing depending on the selection of data from data file with each iteration.
The full string is ;90004;ea98f132-edeb-4ebe-8efe-684cb949c11b” style=
Could you please help.

I tried the following

“ParamName=_fw_driexternallink”,
//”RegExp=90004;(.*?)\”\\ \\ \\ style”,
//”RegExp=#####;(.*?)\”\\ \\ \\ style”,
“RegExp=#####;(.*?)\”\\ \\ \\ style”,
SEARCH_FILTERS,
“Scope=Body”,
“IgnoreRedirections=No”,
LAST);

Any help is much appreciated.


Thanks
Sree.

Sureshkumar
May 22, 2017 Reply

Try this,

web_reg_save_param_regexp(
“ParamName=Correlatetry”
“Regexp=\”([0-9]+)\”,\”[a-z0-9]+\””
Last
);

Daniel Spavin
May 23, 2017 Reply

Hi Sree,

Try this:

web_reg_save_param_regexp(“ParamName=_fw_driexternallink”,”Regexp=;[0-9]{5};([^\”]+)\”
style=”,”Ordinal=1″,LAST);

Ken
October 14, 2014 Reply

I have update 11.52, but am not successful in using multiple capture groups. Are there additional options
needed when trying to use this strategy. I tried variations on the group setting, but it does not look like you can
capture more than one at a time to put in a variable. At least, I could not do what is proposed above. I just
opted for two variables with the same reg exp, but the portion I am interested in placed in parentheses. And I
could not find a reference for this in the What’s new section of the help for 11.52.

@LR Guy – Have you tried either to force it to not be greedy for that last word problem, or using the \w word
character indicator in your regular expression?

LR Guy
July 30, 2014 Reply

Hi,
How would you correlate the last word of a question when you have different questions? I am trying to
correlate the last word of the sentence because that is an answer for each question. There are several questions
but the webpage will ask one at a time. So far what I have done:
Correlated the questions.
Tried to correlate last word by using space in left boundary and “?” as right boundary. This is because the
questions will be different and in a different lengths. The Right boundary will always be “?” because these are
questions.

Any help would be appreciated.

Thank you.

Raju
April 27, 2014 Reply

This is some what complicated code.

Solution: web_reg_save_param_regexp(“ParamName=ParamValue”,”RegExp=rows”:\[\[“[^”\r\n]*”,”([A-
Z]{3})”,”[^”\r\n]*”,”[^”\r\n]*”,”[^\/]+\/[\d]+?\/2011″,”[A-Za-
z]*”,”[^”\r\n]*”,”[^”\r\n]*”,”([^”\r\n]*)”,”[^”\r\n]*”,”([^”\r\n]*)”,LAST);

Stuart Moncrieff
December 11, 2013 Reply

Check out http://regexpal.com/ as a good way of developing and testing your regular expressions.
2.Different types of corrleations

Correlation is classified into 2 categories in VUGen/LoadRunner:

 Automatic correlation
 Manual correlation

Automatic Correlation
LoadRunner can detect dynamic values in the script and suggest their
replacement with parameters. For automatic correlation, LoadRunner
uses rule-based, recording-based, and replay-based correlations.
In this topic:

 Rule-based correlation
 Recording-based correlations
 Replay-based correlations

Rule-based correlation
LoadRunner comes with a set of predefined, extendable rules for how to
correlate dynamic values in well-known environments.

Example: An example of a rule in pseudo-code might be:

Find text that appears In the response body between


string __VIEWSTATE” value=” and the nearest ”character and save it in
parameter “AspNet_ViewState” to correlate the recorded value.

During code generation, LoadRunner scans server responses for values


that match the Correlation Rules. When a matching value is found,
LoadRunner adds a step to extract the value and save it in a parameter.
Then, the script code is scanned for the value and matches are replaced
with a reference to the parameter.
For information about tuning the rules-based correlation, see Automatic
Correlation Configuration.
Back to top

Recording-based correlations
After code generation, the script is scanned for additional correlation
candidates in the client request steps. If a candidate was received from
the server before it is sent by the client, it is suggested as a correlation.
The suggestion includes the exact description of where and how to
extract the dynamic value from the server response and where to
replace data with a parameter.
You can accept suggestions in the Design Studio.
Back to top

Replay-based correlations
Replay the script at least once. It is not a problem at this stage if some
steps fail.
The Replay-based scan compares the server responses before the
failures for mismatched values. If such mismatched values are used in
the script, they are suggested as correlations.
Repeat this process until the last failure is detected and correlated.

Correlation - Handling Dynamic Data


Web pages sent from the server to the browser often contain dynamic
data that the client must return in later requests. The process of locating,
extracting and replacing recorded dynamic values with values valid at
replay is called "correlation".
Common examples of dynamic data are:

 Session ID

 Timestamp
 Customer ID

 Authentication token
This information generally becomes invalid when the session is
completed. At the next session, the same items are sent, but the values
are different.
After recording the business process in LoadRunner, the script might
contain dynamic values in the arguments of the generated API functions.
When the script is replayed, these recorded values are sent to the
server. However, the web server rejects them because they are not valid
in the replay session. Generally, the test fails when this happens.
Example of a dynamic value as received from the server and as it
appears in the recorded script:
Response Body

Resulting script
To enable successful replay, the script must:

 Locate the dynamic data in the server responses, including headers.

 Extract and save that dynamic data.

 Replace the hard-coded dynamic data from the recording session with
the data from the current replay session.
Dynamic data is located using boundaries definitions, regular
expressions, attributes, XML queries, or JSON queries as appropriate.
The data is extracted and the value is saved to a parameter.
The parameter is used instead of the recorded value in later requests to
the server.
Some of the correlation is handled automatically by LoadRunner. You
can configure the automatic correlations. For more information,
see Automatic Correlation and Automatic Correlation Configuration.
Dynamic data that is not correlated automatically requires your
intervention. For more information, see Manually Correlate
Scripts and Design Studio.
If the script still fails on correlation problems, you can use the advanced
techniques. For more information, see Advanced Correlation
Techniques.

Note: Although parametrization and correlation both


use LoadRunner parameters, the purpose is different.

 Parameterization is used to vary the requests based on a list of


values you provide. Parameterization is not dependent on
preceded responses from the server.

 Correlation uses data from the server in subsequent requests so


that the server does not reject the request.

3.how to randomize correlated value

Web_reg_save_param (“varname1”,”LB=”, “RB=”, “ORD=ALL”, LAST);

lr_save_string(lr_paramrr_random(“ varname1”, “Randomvar1”);

web_convert_param("cToken7","SourceString={cToken6_1}","SourceEncoding=URL","TargetEncoding
=PLAIN",LAST);

randVal = lr_paramarr_random("cNodeID");

lr_save_string(randVal, "RandcNodeID");

4.String functions
strcat Concatenates two strings.

strchr Returns the pointer to the first occurrence of a character in a


string.

strcmp Compares two strings to determine the alphabetic order.

strcpy Copies one string to another.

strdup Duplicates a string.

stricmp Performs a case-insensitive comparison of two strings.

strlen Returns the length of a string.

strncat Concatenates n characters from one string to another.

strncmp Compares the first n characters of two strings.

strncpy Copies the first n characters of one string to another.

strnicmp Performs a case-insensitive comparison of n strings.

strrchr Finds the last occurrence of a character in a string.

strspn Returns the length of the leading characters in a string that


are contained in a specified string.

strstr Returns the first occurrence of one string in another.


strtok Returns a token from a string delimited by specified
characters.

5.diff between html and url mode and when we go for these options

1. HTML based mode, records script for every user action that is performed during
recording (hmmm…sounds like QTP) whileURL based mode records each and every
browser request to the server and resources received from the server. Confused? ok,
HTML based mode does recording as you perform clicks and doesn’t give you inside
information like what is happening behind the recording while URL based mode records
each and every step and emulate Javascript code.
2. From the point1) above you can guess, HTML mode would have less correlation to
do whileURL mode has much more complex correlation requirements.
3. HTML mode is smaller and is more intuitive to read as the statements are inside the
functions corresponding to the user action performed. In the case of URL based, all
statements gets recorded into web_url()
4. HTML mode is recommended for browser applications while URL mode is
recommended for non-browser applications.
5. Lastly, don’t get the impression that I am advocating for HTML mode :). URL mode can
be of real help when you want to have control over the resources that need to be or need
not to be downloaded, since you have each and every statement in-front of you (point 1)
6. (i) HTML based: HTML based recording is also called as context-sensitive (or
context based) recording. In this mode of recording, each user action is recorded as
a separate request. For Example, when a user performs an action (example login),
one ‘login request’ is created.
7. In the Example below, we have the Vugen script recorded in the HTML mode for
invoking the url and logging into the ‘Web tours’ application.
8. Here there are two user actions – Invoke url and Login. Thus two requests are
recorded, one for each of these user actions.
9. // Request1 – Invoke Web Tours url
10. web_url("index.htm",
11. "URL=http://127.0.0.1:1080/WebTours/index.htm",
12. "Resource=0",
13. "RecContentType=text/html",
14. "Referer=",
15. "Snapshot=t1.inf",
16. "Mode=HTML",
17. EXTRARES,
18. "Url=../favicon.ico", "Referer=", ENDITEM,
19. "Url=https://www.bing.com/favicon.ico", "Referer=", ENDITEM,
20. LAST);
21. // Request2 – Login
22. web_submit_form("login.pl",
23. "Snapshot=t2.inf",
24. ITEMDATA,
25. "Name=username", "Value=jojo", ENDITEM,
26. "Name=password", "Value=bean", ENDITEM,
27. "Name=login.x", "Value=47", ENDITEM,
28. "Name=login.y", "Value=10", ENDITEM,
29. LAST);
30. Also, if we see, the first request shows the url but the second doesn’t. Which means
the second request (Login) is dependent on the response of the previous request
(invoke url) and hence this mode of recording is called the ‘Context-sensitive’
recording.
31. The advantage of HTML based recording is that the scripts are smaller and simple
and do not require much customization/enhancements (correlation etc.).
32. The flipside is that the maintenance of the scripts may become difficult – the
requests being context sensitive, any UI change would impact the script and may
lead to errors on replay.
33. An HTML based recording is generally recommended for browser-based
applications.
34. (ii) URL based: URL based recording is also called as context-insensitive or
contextless recording. In this mode of recording, each request to the server (initiated
by a user action) is recorded as a separate request with the url.
35. For Example, when a user performs an action (E.g. login to an application), along
with the main login HTML page, non-html resources like the images, javascript, CSS
files etc. are also downloaded. URL based recording generates requests for each of
these requests separately.
36. In the Example below, we have the Vugen script recorded in the URL mode for
launching the url and logging into the ‘Web tours’ application.
37. Here again, there are two user actions – Invoke url and Login, But there are more
than two requests as the images and icons associated with the ‘Invoke url’ action are
recorded as separate requests.
38. // Request1 – Invoke Web Tours url
39. web_url("index.htm",
40. "URL=http://127.0.0.1:1080/WebTours/index.htm",
41. "Resource=0",
42. "RecContentType=text/html",
43. "Referer=",
44. "Snapshot=t1.inf",
45. "Mode=HTTP",
46. LAST);
47.
48. web_concurrent_start(NULL);
49. // Request1a - image
50. web_url("hp_logo.png",
51. "URL=http://127.0.0.1:1080/WebTours/images/hp_logo.png",
52. "Resource=1",
53. "RecContentType=image/png",
54. "Referer=http://127.0.0.1:1080/WebTours/header.html",
55. "Snapshot=t3.inf",
56. LAST);
57. // Request1b - image
58. web_url("webtours.png",
59. "URL=http://127.0.0.1:1080/WebTours/images/webtours.png",
60. "Resource=1",
61. "RecContentType=image/png",
62. "Referer=http://127.0.0.1:1080/WebTours/header.html",
63. "Snapshot=t4.inf",
64. LAST);
65. web_concurrent_end(NULL);
66.
67.
68. web_concurrent_start(NULL);
69.
70. // Request1c - icon
71. web_url("favicon.ico",
72. "URL=http://127.0.0.1:1080/favicon.ico",
73. "Resource=1",
74. "Referer=",
75. "Snapshot=t9.inf",
76. LAST);
77.
78. // Request1d - icon
79. web_url("favicon.ico_2",
80. "URL=https://www.bing.com/favicon.ico",
81. "Resource=1",
82. "RecContentType=image/x-icon",
83. "Referer=",
84. "Snapshot=t10.inf",
85. LAST);
86.
87. web_concurrent_end(NULL);
88. // Request2 – Login
89. web_submit_data("login.pl",
90. "Action=http://127.0.0.1:1080/cgi-bin/login.pl",
91. "Method=POST",
92. "RecContentType=text/html",
93. "Referer=http://127.0.0.1:1080/cgi-bin/nav.pl?in=home",
94. "Snapshot=t12.inf",
95. "Mode=HTTP",
96. ITEMDATA,
97. "Name=userSession", "Value=123203.335763467zDDHcHVpfiDDDDDDDiAc",
ENDITEM,
98. "Name=username", "Value=jojo", ENDITEM,
99. "Name=password", "Value=bean", ENDITEM,
100. "Name=JSFormSubmit", "Value=off", ENDITEM,
101. "Name=login.x", "Value=47", ENDITEM,
102. "Name=login.y", "Value=10", ENDITEM,
103. LAST);
104. If we see, all the requests have their respective URLs. Which means the
requests are not dependent on the response of the previous request, hence this
mode of recording is called ‘Context-less’ recording.
105. Scripts generated in the URL based recording are large and complex, hence
they require more customization/enhancements (correlation etc.).
106. However, the maintenance of the scripts is easy, as the requests are being
contextless, any UI change would not impact the script.
107. An URL based recording is generally recommended for non-browser
(Windows) based applications.
108. In the HTML mode, there is a second option ‘A script containing explicit URLs
only’ which combines the advantages of both (HTML and URL modes of recording) –
the script remains small and simple, hence the maintenance of the scripts becomes
easy. This mode of recording is mostly recommended for Web Applications.

109.
6.When and how to build own web_custom request

7.Diff between web_submit request and web_submit form

8.Run Block concept

9.What do you do when your script doesn’t record in vugen

10.Pacing and little ‘s Law

Always Apply Little's Law for calculate Pacing, ThinkTime, No.of VUsers

From Little's Law: No of VUsers= Throughput*(Responce_Time + Think_Time)


Expl.

Throughput= Total No of Transactions/Time in Seconds , Pacing= (Response_Time + Think_Time)


From Your Requirements- Total No of iterations 100 and 1 iteration have 6 transactions, So
total no of transactions = 600

Throughput for 1 Minute is: 600/60 = 10 , Throughput for 1 Sec is: 0.16
According to formula 50 = 0.16*(Pacing) Pacing = 312.5 seconds

To achieve 100 Iterations in 1 Hour you have to set pacing 312.5 seconds, Make sure
Pacing = Response_time + Think_Time.

What are different error during execution


This question for the times when you have to use WinInet replay engine in loadrunner. A timeout
error is observed when the response time is more than 30 seconds. By default wininet has timeout set
to 30 seconds. There is a way to make it retry the request but in my situation it's a post request and
retry is not a realistic case. Error encountered is -

Error -27492: "HttpSendRequest" failed, Windows error code=12002 and retry limit (0)
exceeded for URL="https
Screenshot of RTS:

Is there a way to configure the timeout to higher value and where to do it?
LR12.53, Windows server 2008

New Information
To demonstrate above behaviour, I have created a web app which takes more than 30 seconds to
respond to a GET request. I have also enabled WinInet replay in runtime settings in Loadrunner like
shown in above diagram.

Action of the script


Action()
{
lr_start_transaction("slow_transaction");

web_custom_request("slow_transaction",
"URL=http://localhost:8887/slow_response",
"Method=GET",
"TargetFrame=",
"Resource=0",
"Referer=",
"Mode=HTML",
"Body=",
LAST);

lr_end_transaction("slow_transaction", LR_AUTO);

return 0;
}
On execution of above script with advanced trace, I can see following logs. Error observed
is Action.c(6): Error -27492: "HttpSendRequest" failed, Windows error code=12002 and
retry limit (0) exceeded for URL="http://localhost:8887/slow_response" [MsgId: MERR-
27492]
Action.c(4): Notify: Transaction "slow_transaction" started.
Action.c(6): web_custom_request("slow_transaction") started [MsgId: MMSG-26355]
Action.c(6): DETECTING_PROXY" on behalf of "URL="http://localhost:8887/slow_response"
[MsgId: MMSG-27397]
Action.c(6): RESOLVING_NAME" on behalf of "URL="http://localhost:8887/slow_response"
[MsgId: MMSG-27397]
Action.c(6): NAME_RESOLVED" on behalf of "URL="http://localhost:8887/slow_response"
[MsgId: MMSG-27397]
Action.c(6): CONNECTING_TO_SERVER" on behalf of
"URL="http://localhost:8887/slow_response" [MsgId: MMSG-27397]
Action.c(6): CONNECTING_TO_SERVER" on behalf of
"URL="http://localhost:8887/slow_response" [MsgId: MMSG-27397]
Action.c(6): CONNECTED_TO_SERVER" on behalf of
"URL="http://localhost:8887/slow_response" [MsgId: MMSG-27397]
Action.c(6): SENDING_REQUEST" on behalf of "URL="http://localhost:8887/slow_response"
[MsgId: MMSG-27397]
Action.c(6): REQUEST_SENT" on behalf of "URL="http://localhost:8887/slow_response"
[MsgId: MMSG-27397]
Action.c(6): RECEIVING_RESPONSE" on behalf of
"URL="http://localhost:8887/slow_response" [MsgId: MMSG-27397]
Action.c(6): CLOSING_CONNECTION" on behalf of
"URL="http://localhost:8887/slow_response" [MsgId: MMSG-27397]
Action.c(6): CONNECTION_CLOSED" on behalf of
"URL="http://localhost:8887/slow_response" [MsgId: MMSG-27397]
Action.c(6): REQUEST_COMPLETE" on behalf of
"URL="http://localhost:8887/slow_response" [MsgId: MMSG-27397]
Action.c(6): Error -27492: "HttpSendRequest" failed, Windows error code=12002 and
retry limit (0) exceeded for URL="http://localhost:8887/slow_response" [MsgId:
MERR-27492]
Action.c(6): HANDLE_CLOSING" on behalf of "URL="http://localhost:8887/slow_response"
[MsgId: MMSG-27397]
Action.c(6): web_custom_request("slow_transaction") highest severity level was
"ERROR", 0 body bytes, 0 header bytes [MsgId: MMSG-26388]
Action.c(6): Notify: Transaction "slow_transaction" ended with a "Fail" status
(Duration: 31.1355 Wasted Time: 0.1075).
Now on setting retry with web_set_max_retries("2"); in the script, we can clearly see in the logs
that it is retrying it after sometime when response doesn't arrive but this will fail too as its a new
request and will again take more than 30 seconds ;)
Logs for retry:
Action.c(7): CLOSING_CONNECTION" on behalf of
"URL="http://localhost:8887/slow_response" [MsgId: MMSG-27397]
Action.c(7): CONNECTION_CLOSED" on behalf of
"URL="http://localhost:8887/slow_response" [MsgId: MMSG-27397]
Action.c(7): REQUEST_COMPLETE" on behalf of
"URL="http://localhost:8887/slow_response" [MsgId: MMSG-27397]
Action.c(7): Attempting "HttpSendRequest" retry due to Windows error code=12002 for
URL="http://localhost:8887/slow_response" [MsgId: MMSG-27491]
Action.c(7): DETECTING_PROXY" on behalf of "URL="http://localhost:8887/slow_response"
[MsgId: MMSG-27397]
Action.c(7): CONNECTING_TO_SERVER" on behalf of
"URL="http://localhost:8887/slow_response" [MsgId: MMSG-27397]
Action.c(7): CONNECTED_TO_SERVER" on behalf of
"URL="http://localhost:8887/slow_response" [MsgId: MMSG-27397]
Now that we have evidence of WinInet retrying after about 30 seconds. Can I please request HP
support or other LR experts, WinInet experts to suggest if there is a way to increase the timeout in
WinInet and how?

 Please clarify how you know this to be a Windows Integrated Identity and Security issue which requires a
retry – James Pulley Jul 7 '17 at 15:20
 Hi James, I dont want it to retry the request, want it to wait for more time (synchronous). Its because
some of my applications take longer than 30 seconds (it is accepted) to respond and in this case LRs
default playback (sockets) doesnt work. Been observing other issues with that. That's entirely a different
question. So simply put, need a way to increase the WinInet Default timeout which is 30
seconds. – dnafication Jul 11 '17 at 1:46
 Standard HTTP timeout is 120 seconds. This means not so much as a single byte is returned inside of
that window. Are you certain you are not looking at connection timeout, which is different than response
timeout? – James Pulley Jul 11 '17 at 19:32
 hi all, I have added new information and evidence of lr timeout while using wininet replay engine. Please
read the question again. – dnafication Jul 12 '17 at 1:42
 You are on localhost. You should not be using a proxy for connection – James Pulley Jul 12 '17 at 13:19
add a comment

2 Answers
activeoldest votes

Actualy, the WinInet replay engine has nothing to do with setting the timeout parameter in runtime
settings.

There are 2 places you need to change it:

1. Runtime settings > Internet Protocol > Preferences > General > "Step download timeout":
2. Runtime settings > Internet Protocol > Preferences > HTTP > "HTTP request connect timeout",
"HTTP request receive timeout" and "HTTP Keep Alive timeout":

shareimprove this answer


answered Jul 11 '17 at 6:20
Koby Douek

11.7k143762

 Ask yourself, if you really have not received so much as a single byte of response inside of the default
timeout of 120 seconds, is it really advisable to change the timeout to a higher value? I would be willing to
bet that a two minute non-response would be considered not acceptable. – James Pulley Jul 11 '17 at 19:33
 this answer doesn't solve my problem. – dnafication Jul 12 '17 at 2:23
add a comment

You are connecting to the local host, i.e., the same machine. You should not be sending your items
through a Proxy for a local machine connection. Turn off any proxy settings.

Next, you are on a local machine. This makes the network cost zero as you will simply be bouncing
through the bottom of the stack and back up, never hitting the network interface card nor exiting the
box. This means the timeout is explicitly not related to network and has to be a configuration issue on
the target service on your local machine.

As you are signed into Localhost and you are connecting to localhost, your security context for any
execution should be your credentials where you are signed into localhost. I still do not see how this is
a windows integrated authentication issue in your code, but if it is and your target service is fully
integrated with a Windows security context, then consider that you may need a few header fields
with your security credential information.

ERROR CODES

top
5xx Server Error
The server failed to fulfill an apparently valid request.
Code Status Explanation
500 Internal Server Error Nasty response that is usually caused by a problem in your
Perl code when a CGI program is run.
501 Not Implemented The request cannot be carried out by the server.
502 Bad Gateway The server you're trying to reach is sending back errors.
503 Service Unavailable The service or file that is being requested is not currently
available.
504 Gateway Timeout The gateway has timed out. Like the 408 timeout error, but
this one occurs at the gateway of the server.
505 HTTP Version Not Supported The HTTP protocol you are asking for is not supported.
top
1xx Informational
Request received, continuing process.
Code Status Explanation
100 Continue The request has been completed and the rest of the process
can continue.
101 Switching Protocols When requesting a page, a browser might receive a statis
code of 101, followed by an "Upgrade" header showing that
the server is changing to a different version of HTTP.
top
2xx Success
The action was successfully received, understood, and accepted.
Code Status Explanation
200 OK Standard response for HTTP successful requests.
201 Created When new pages are created by posted form data or by a
CGI process, this is confirmation that it worked.
202 Accepted The client's request was accepted, though not yet processed.
203 Non-Authorative The information contained in the entity header is not from the
Information original site, but from a third party server.
204 No Content If you click a link which has no target URL, this response is
elicited by the server. It's silent and doesn't warn the user
about anything.
205 Reset Content This allows the server to reset any content returned by a CGI.
206 Partial Content The requested file wasn't downloaded entirely. This is
returned when the user presses the stop button before a
page is loaded, for example.
top
3xx Redirection
The client must take additional action to complete the request.
Code Status Explanation
300 Multiple Choices The requested address refers to more than one file.
Depending on how the server is configured, you get an error
or a choice of which page you want.
301 Moved Permanently If the server is set up properly it will automatically redirect the
reader to the new location of the file.
302 Moved Temporarily Page has been moved temporarily, and the new URL is
available. You should be sent there by the server.
303 See Other This is a "see other" SRC. Data is somewhere else and the
GET method is used to retrieve it.
304 Not Modified If the request header includes an 'if modified since'
parameter, this code will be returned if the file has not
changed since that date. Search engine robots may generate
a lot of these.
305 Use Proxy The recipient is expected to repeat the request via the proxy.
top
4xx Client Error
The client failed to provide an valid request.
Code Status Explanation
400 Bad Request There is a syntax error in the request, and it is denied.
401 Authorization Required The request header did not contain the necessary
authentication codes, and the client is denied access.
402 Payment Required Payment is required. This code is not yet in operation.
403 Forbidden The client is not allowed to see a certain file. This is also
returned at times when the server doesn't want any more
visitors.
404 Not Found The requested file was not found on the server. Possibly
because it was deleted, or never existed before. Often
caused by misspellings of URLs.
405 Method Not Allowed The method you are using to access the file is not allowed.
406 Not Acceptable The requested file exists but cannot be used as the client
system doesn't understand the format the file is configured
for.
407 Proxy Authentication The request must be authorised before it can take place.
Required
408 Request Timed Out The server took longer than its allowed time to process the
request. Often caused by heavy net traffic.
409 Conflicting Request Too many concurrent requests for a single file.
410 Gone The file used to be in this position, but is there no longer.
411 Content Length The request is missing its Content-Length header.
Required
412 Precondition Failed A certain configuration is required for this file to be delivered,
but the client has not set this up.
413 Request Entity Too The requested file was too big to process.
Long
414 Request URI Too Long The address you entered was overly long for the server.
415 Unsupported Media The filetype of the request is unsupported.
Type

What are the different scripting issues you faced so far?


Ans) some of the important real times which I have faced
are
(a) When I am recording the loadrunner script , the script
has been not recorded then I have checked the Network
options changed the capture level from WinNet level data
to Socket level data, also added the new entry Server-
>All, Port->Any and service->Auto detect, SSL->No

8. What are the Challenges that you face during scripting?


Ans) Challenges faced on the scripting
1) Using of the file functions in the scripting of Vugen
2) Using of the randomization techniques in scripting
3) Handling the correlation for the .Net and java applications like view state , Even
validation , session ids…etc

What are the performance bottlenecks that you found in


projects you were working? What are the
recommendations made to overcome those issues?
Ans) I have found the many bottlenecks in application, some
of them are
(a) I have found the bottleneck in the Javascript request
which is taking more response time than SLA (service level
agreement) , when I studied deeply into it , the main cause
for taking the high response time is the loading of the css
file is very heavy to download and redirection is happening
while loading the content. (It is fixed by using angular js
instead of simple java script)
(b) For logging into application and also which includes
database related transactions are very slow, then I have
looked into the tables in the database indexing is not
present in the tables, once the indexing is attached for the
tables then readability of the very fast when compare to
previous results.

3. Have you applied Little’s law in your project? If so, how?


Ans) Yes, The law states that the average number of
customers in a system (over some time interval), N, is
equal to their average arrival rate, X, multiplied by their
average time in the system, R.
N=X.R
This law is very important to check whether the load testing
tool is not a bottleneck.
For Example, in a shop , if there are always 2 customers
available at the counter queue , wherein the customers are
entering the shop at the rate of 4 per second , then time
taken for the customers to leave from the shop can be
calculated as
N=X.R
R = 2/4 = 0.5 seconds
A Simple example of how to use this law to know how many
virtual users licenses are required:
Web system that has peak user load per hour = 2000 users
Expected Response time per transaction = 4 seconds
The peak page hits/sec = 80 hits/sec
For carrying out Performance tests for the above web system,
we need to calculate how many number of Virtual user
licenses we need to purchase.
N = X. R
N = 80 . 4 = 320
Therefore 320 virtual user licenses are enough to carry out
the Load Test.
Eg: Any website, Login and check the URL. The URL consist
of Session Value which is dynamically generated by the
Server and even developer cannot tell that "What the
dynamic value is going to generated"

What do you monitor while execution?


Ans) While execution of the desired scenarios for the
application , we always look for both client side metrics
like transaction response time, throughput, hits per
second , Running Vusers ..Etc and server side metrics too
like CPU Utilization, Memory consumption, garbage
collector performance …etc

10. How do you handle the error handling in scripting?


Ans) Error handling can be done in the scripting of the
loadrunner , to give the user friendly messages to the users
and make sure that script which we are running is
navigating through the entire application flow according to
the work flow.
Example:
web_reg_find("Text=Login","SaveCount=Text1",LAST);
lr_start_transaction("Demo_Login");
web_url(........)
if(atoi(lr_eval_string("{Text1}"))>0) Note: array to integer.
{
lr_end_transaction("Demo_Login",LR_PASS);
}
else
{
lr_end_transaction("Demo_Login",LR_FAIL);
lr_error_message("%s",lr_eval_string("Login is failed for
this user {VuserID} Iteration number
{Iteration_Number}"));
lr_exit(LR_EXIT_MAIN_ITERATION_AND_CONTINUE,L
R_FAIL);
}

Vous aimerez peut-être aussi