Systems & Software Talk 

Visitors since August 14, 2007: Free  Web Counters
Free Hit Counters

LoadRunner: web_reg_save_param(); SaveLen and SaveOffset

09:31, 2007-Aug-11  ..  Posted in LoadRunner Tips and Tricks  ..  0 comments  ..  Link

Parameter parsing: web_reg_save_param() (WRSP) – SaveLen & SaveOffset;

Have you ever used WSRP to capture a value that looks similar to this? "123450_67811_909876543".

You capture it and then you must use it in a subsequent POST or GET. However, it might not be the same string each iteration which is why you correlated it in the first place! On top of that you might need to substitute the "_" underscore characters with one or more characters for the subsequent POST or GET such that it must look like this:

"123450%5F67811%5F909876543", where the instances of the underscores are replaced with "%5F" – for example. Now let us assume that the original numeric portion is 1) fixed length, and 2) the segments within are fixed length. If those criteria are not met, this will not work for you. Otherwise this situation allows us to use WRSP versus writing some custom "C" to manipulate character buffers. Before showing how to solve this situation with WRSP, let us take another look at the value, "123450_67811_909876543". Let us also say that a next script iteration might return this value to the WRSP, "100010_22255_900777040". Remember that you must now replace the two underscores (2 chars) with "%5F" or a total of six chars. Below is a way to accomplish this. As always, you would place the WRSP statements before the GET or POST that causes the value to be returned to your Vuser’s dynamic parameter.

Again, assuming the captured value is constant length and each segment within is fixed length and the value returned for said iteration is "100010_22255_900777040", we would use the below to setup three dynamic parameters from the same string; taking advantage of WRSP arguments "SaveLen" and "SaveOffset". In the below, use the same right and left boundaries for each WRSP (wrsp is used below. You would of course use web_reg_save_param();).

wrsp("Segment1", "LB=Left", "RB=Right", "SaveLen=6", "SaveOffset=0", LAST);

wrsp("Segment2", "LB=Left", "RB=Right", "SaveLen=5", "SaveOffset=7", LAST);

wrsp("Segment3", "LB=Left", "RB=Right", "SaveLen=9", "SaveOffset=13", LAST);

We now have three dynamic parameters as follows:

{Segment1} = "100010",  {Segment2} = "22255",  {Segment3} = "900777040"

Notice that we did not capture the underscore character.

Assuming you must now use the example "%5F" in lieu if the underscore character in a POST or GET, the below is an example of how you would proceed.

/* Then your subsequent GET or POST would look like this: */

web_submit_data (or web_url, etc.) ... ITEMDATA,

"Name=NamedItem", "Value= {Segment1}%5F{Segment1}%5F{Segment1}", ENDITEM,

The actual above value returned to the server in this example would be:

100010%5F22255%5F900777040

Circular heh?


 

{ Last Page }   { Page 13 of 46 }   { Next Page }

About Me

Home
My Profile
Archives
Friends
My Photo Album

Links

Corey Goldberg
Effective Testing?
Bj Rollison I.M. Testy Blog
Alan Page: Software Testing & Rants
Dmitry's LoadRunner and QTP Blog
Veterans History Project
Air Traffic Control Watch
Music Making Fun
My home 1972-1975

Categories

Functional Testing
Performance Horror
Development
Performance Testing
General
Tools Tips
Warped Humor
LoadRunner Tips and Tricks

Recent Entries

New Year’s Eve of 2010 Catastrophe In the Works
Introducing Testalis
Defect Report - Politically Correct
Performance Testing Vuser Personas – Part I
Happy Holidays 2007

Friends

LauraScharp
philk10
richardw100
aalhait
jimhazen
strazzerj
Lynnem
bru
EklecticTester
jgottlieb
leakybrain
michaeljf
prainbow
rajeshmathur
rstens
Yury
zeeslo
whollymindless

Syndication

RSS Site Feed