Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1



    i have the following code, from the below code I want to pick "1945" with the help of web_reg_save_param. Is there anyone who can provide a quick help.

    The pattern I see is:
    The records is comma delimited,
    all values are encapsulated by quotation marks,
    the alert ID (1945)always shows up as the 11th value.

    :[{"containerName":" ","containerSize":"12","containerStartRow":"0","co ntainerEndRow":"0","rows":[[

    NW,RO,RA","DLY","10/07/2011","10/17/2011","10/13/2011","RA","Y","FR","AMEA","AC","1945","50","50"," AC 100IOSH-08","User


    ["NW,RO,RA","DLY","09/29/2011","10/17/2011","10/13/2011","RA","Y","MF","AMEA","AC","1927","50","50"," AC 25DNOFINALHH-

    032","User Defined","09/29/2011","Reassigned","10/27/2011","SAISUPERVISOR","SAISUPERVISOR","0","25DNOFI NALHH-

    032","113000002","GEN",],]},],"innerTableContainer":{},"columnDisplayOrder":"15 1,28,31,1000,1001,1002,1003,40,37,25,15,12,2,3,4,8 ,9,10,11,13,38,39,1,6","rowCount":"12"}}]},] ,"containerMode":"1"} ]}]}}

  2. #2

    Re: web_reg_save_param

    Anyone please help me on this..

  3. #3

    Re: web_reg_save_param

    There are no SLA's in an all volunteer forum....particularly for a question which is addressed in both the standard VUGEN web training class, the manuals and the online help system
    James Pulley

    Replace ineffective offshore contracts, LoadRunnerByTheHour. Starting @ $19.95/hr USD.

    Put us to the test, skilled expertise is less expensive than you might imagine.

    Twitter: @LoadRunnerBTH @PerfBytes

  4. #4

    Re: web_reg_save_param

    Check if the RB and LB around 1945 - is always same or it changes dynamically.
    If its same all the time -- even if one of them is same -- then its fairly simple to extract this value using WRSP -- just follow the function reference and example given there.
    If the LB/RB changes every iteration...then definitely you will need slightly different approach.
    But I can tell you - this is not hard at all -- just spend some time on function reference in LR manual and some practice.

  5. #5

    Re: web_reg_save_param

    Thanks lordoftherings for your reply, the RB and LB around 1945 will not be same. It will depend of the search which is coming from the previous page.
    The only thing which will be constant is "rows":[[" as LB and "innerTableContainer" as RB.

    i will be very thankful, if you provide me the solution. I tried it in many ways, but did't get any solution.

  6. #6

    Re: web_reg_save_param

    Look up Floris Kaanak's Ylib C Functions for LoadRunner. He has several string manipulation functions that can be usedin this ckind of a situation

  7. #7

    Re: web_reg_save_param

    I'm not sure the OP will gain much from this but this is a nice example of where a regexp is better than using the classic wrsp() with boundaries. The function web_reg_save_param_regexp() is pretty cool in my book and allows you to use the much more flexible method of regular expressions to match strings. It is only available in LR11 and later versions.

    Note. Anyone starting out with regexps will want a handy regexp tester, like rubular.com.

    So, the response we see here is in fact json. Messy business using LBs & RBs on json, prone to error. A better method is to use a regular expression.

    In this case, one regexp you could use is:


    This will return:


    [^"\r\n]* will match everything not a newline or double quote within each grouping of "" which is a useful annotation to get used to for load testing scripts - we frequently want to capture things inside double quotes! The captured value is that enclosed in parenthesis - this is what populates your parameter. You can replace any expression, such as [^"\r\n]*, with any hard-coded strings or a more specific expression to make the match more certain - I've demonstrated this with RA, FR and AMEA where I left the values hardcoded.

    But you can go further. For example, you could use


    to match any three uppercase chars, this will match DLS near the start of the string but not DLSS or dls, nor will it match null or DL. [A-Z]* will match any number of uppercase chars including zero. Or DL[A-Z] will match DLS or DLA or DLX etc. but not DXA. The possibilities are vast.

    Here's some more examples:


    Notice how I can filter on specific dates? You can get really deep and filter on ranges

    Note multiple matches work in the same way as with the classic wrsp() using boundaries, you specify Ordinal=ALL and get param_1, param_2...param_count, etc.

    Sadly, LR11 & 12 only support using a single matching group. This is a shame as you could have a regexp like:


    That would return multiple matches looking like:

    1 DLY
    2 AMEA
    3 1945

    So now you get an array of results, which is pretty nice. Instead, for LR, you'd need multiple wrsp_regexp() statements. If any of those groups were to match multiple times then you would have got a multi-dimensional array like param_g1_1, param_g1_2 or param_g2_1. This is extremely powerful and one of the features I love about certain other load testing tools.

    In general, one thing you need to be aware of when using regexps in load testing is greediness causing backtracking - this is crucial, if you don't take care you'll eat CPU on your Load Generator machines.

    Finally, for the OP, I suspect that the you've manually entered some newline characters when you copied this string in your post - these will need removing from the regexp to make it match if they are not present in the actual response. But then this also serves as a nice demonstration for how easy newline chars are to deal with in regexps (you just type \n).

  8. #8

    Re: web_reg_save_param

    Thanks Oliver, but what would be the RB and LB in that case. I tried it with your example, but still it didn't work.

  9. #9

    Re: web_reg_save_param

    Yes, I thought that might go over your head.

    First of all, do you have LR11? If not, get it, if you can't, ignore my reply.

    Second, I'm talking about a different function: web_reg_save_param_regexp(), not web_reg_save_param(). In this function there are no LB or RB values, you use a regular expression.

  10. #10

    Re: web_reg_save_param

    if you're using LR pre v11 then the easiest thing to do is grab a much bigger chunk of the response than you need and chop it up - strtok documentation is a good place to start, but it's not the most elegant solution (and don't let pt_russell catch you using it!!)


Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
BetaSoft Inc.
All times are GMT -8. The time now is 05:59 PM.

Copyright BetaSoft Inc.