SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Member
    Join Date
    Sep 2008
    Posts
    50
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Using C and Loadrunner code for parameters

    I have a requirement to use a string array to loop through web_reg_save param saving the data returned for each of the parameters then later using the same string array to recall the the value for these parameters.

    The web_reg_save.. works fine and I can recall the value of the parameters by using the actual parameter name but no matter what I try I can not get the string array to return the value of the parameter.. I think this is down to the way that I am utalising the string in the lr_eval_string, can anyone help. Code snippets below, note that Pete Test 4 is the only one that actually returns the value of the parameter and that is because its using the hard coded parameter name.

    Save_Param[0] = "CAD_DATE";
    LB[0] = "CAD";

    lr_save_string(Save_Param[0], "Save_Param_Search");
    lr_save_string(LB[0], "LB_SEARCH");

    web_reg_save_param("{Save_Param_Search}",
    "LB={LB_SEARCH}",
    "RB=tr",
    LAST);

    web_url("SearchType.do",.........

    lr_save_string(Save_Param[0], "Save_Param_Search");

    lr_output_message("Val #1 is: %s", Save_Param[0]); //Returns DPA.c(134): Val #1 is: CAD_DATE

    lr_output_message("Val #2 is: %s", lr_eval_string("Save_Param[0]"));
    //Returns DPA.c(135): Val #2 is: Save_Param[count]

    lr_output_message("Pete Test2 \"%s\"", lr_eval_string("{Save_Param_Search}"));
    //returns DPA.c(137): Pete Test2 "CAD_DATE"

    lr_output_message("Pete Test4 \"%s\"", lr_eval_string("{CAD_DATE}"));
    //Returns DPA.c(140): Pete Test4 "
    </td>

    <td class="BodyTextSize10Blue">
    18/08/2008
    </td>
    </"

  2. #2
    Senior Member
    Join Date
    Aug 2003
    Location
    Atlanta
    Posts
    777
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Using C and Loadrunner code for parameters

    [ QUOTE ]
    lr_output_message("Val #2 is: %s", lr_eval_string("Save_Param[0]"));


    [/ QUOTE ]
    I'm not sure this line of code is doing what you want it to do. What do you expect the values to be?

    We need some further information to help you.

    http://www.sqaforums.com/showflat.ph...e=0#Post117445

    Thanks,
    Terri

  3. #3
    Member
    Join Date
    Sep 2008
    Posts
    50
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Using C and Loadrunner code for parameters

    Essentially I am using LR 8.1 running web protocol. with the line:

    "lr_output_message("Val #2 is: %s", lr_eval_string("Save_Param[0]"));"

    What I'm trying to do is is show that value that is contained in the parameter referenced by Save_Param[0], in this case the parameter name is CAD_DATE. If I just call

    lr_output_message("Pete Test4 \"%s\"", lr_eval_string("{CAD_DATE}"));

    It works. However I'm trying to use C arrays for this so that I can loop through sections of the code repeatedly as I have about 20 diferent web_reg_saves to do then later recalling the values to comparison. I can do it long hand but was just looking for a way to minimise the code down a bit.

  4. #4
    Moderator JakeBrake's Avatar
    Join Date
    Dec 2000
    Location
    St. Louis - Year 2025
    Posts
    15,609
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Using C and Loadrunner code for parameters

    [ QUOTE ]


    We need some further information to help you.

    http://www.sqaforums.com/showflat.ph...e=0#Post117445

    Thanks,
    Terri

    [/ QUOTE ]

  5. #5
    Member
    Join Date
    Sep 2008
    Posts
    50
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Using C and Loadrunner code for parameters

    1. What version of LoadRunner (LR) or PerformanceCenter (PC) are you using? (specify which tool LR or PC)
    LR 8.1

    2. What is the protocol you are recording?
    Web

    2.1 If .NET, which version of .NET does the app require?

    2.2 If .NET, which version of .NET do you have installed?

    2.3 If OracleNCA with Oracle Forms Server, please list the version of Oracle Forms Server. You can get this info from the main Oracle Form when launched - Help -> About


    3. If HTML - are you using HTML-Advanced with URLs or,
    No

    4. If URL mode:
    - Concurrent groups, or
    - Without Concurrent groups?
    (indicate which)

    5. Which LoadRunner/PerformanceCenter feature (FPs) or service packs are you using?
    None

    6. VuGen Recording - are you using Old or New Recording Engine?
    New

    7. What kind of LoadRunner license do you have -
    - Trial or Evaluation,
    - Subscription,
    - Perpetual,
    - Permanent/Unlimited, or
    - Virtual User days?

    Permanent Unlimted 1000 user

    8. If subscription, is subscription current or expired?
    Current

    9. What platform(s) (PCs) and Operating Systems (Windows-XP, etc.)? Include version and service packs (SP1 or 2, etc.)
    XP SP2

    10. If you have filed a service request with HP/Mercury, what have they told you at this point with respect to your issue?
    None filled

  6. #6
    Moderator JakeBrake's Avatar
    Join Date
    Dec 2000
    Location
    St. Louis - Year 2025
    Posts
    15,609
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Using C and Loadrunner code for parameters

    Have you looked through the CODE SHARE topic above? I think an alternative exists in posts dealing with "lr_save_string".

  7. #7
    Member
    Join Date
    Sep 2008
    Posts
    50
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Using C and Loadrunner code for parameters

    Well looking through CODE SHARE theer is on that is close i.e.

    int i, ItemNumCount;
    char namestr[20];

    // your web_reg_save_param
    // your web submit or web url

    ItemNumCount = atoi(lr_eval_string("{namestr_count}"));
    for (i=1;i <=ItemNumCount;i++) {
    sprintf(namestr, "{namestr_%i}", i);
    lr_save_string(lr_eval_string(namestr), "Tempnamestr");
    lr_message("Name: %s", lr_eval_string("{Tempnamestr}"));

    My code is:

    lr_save_string(Save_Param[count], "Save_Param_Search");
    lr_output_message("Pete Test2 \"%s\"", lr_eval_string("{Save_Param_Search}"));

    The problem is that the Save_Param_Search in the last statement just returns the name of the parameter not its value..

  8. #8
    Moderator
    Join Date
    Aug 2001
    Location
    NC
    Posts
    6,039
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0

    Re: Using C and Loadrunner code for parameters

    Pete,

    You have a syntax problem. The syntax you are using, <ul type="square">&lt;name of correlated variable&gt;[&lt;index&gt;][/list]
    is not supported for accessing the array value, instead you need to build a string in the form of
    <ul type="square">"{&lt;name of correlated variable&gt;_&lt;index&gt;}"[/list]
    Please re-reference your training material for LoadRunner. This pseudo-array index structure is covered on both chapters on correlation.
    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

  9. #9
    Member
    Join Date
    Sep 2008
    Posts
    50
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Using C and Loadrunner code for parameters

    I can see how that works for ord values but I am actually using an array to capture diferent searches against different parameters and then just trying to recall these values later. Hence:

    Save_Param[0] = "CADMIS_DATE";
    Save_Param[1] = "CRIMINT_INFO_DATE";
    Save_Param[2] = "CRIMINT_PLUS_DATE";
    Save_Param[3] = "CRIS_DATE";
    Save_Param[4] = "CUSTODY_DATE";
    Save_Param[5] = "MERLIN_DATE";
    Save_Param[6] = "STOPS_DATE";
    Save_Param[7] = "NSPIS_CUSTODY_DATE";
    Save_Param[8] = "AUDIT_DATE";

    LB[0] = "CADMIS";
    LB[1] = "CRIMINT Info";
    LB[2] = "CRIMINT PLUS";
    LB[3] = "CRIS";
    LB[4] = "CUSTODY";
    LB[5] = "MERLIN";
    LB[6] = "STOPS";
    LB[7] = "NSPIS CUSTODY";
    LB[8] = "AUDIT";

    RB[0] = "RB=tr";

    while (count &lt;= 8)
    {
    lr_save_string(Save_Param[count], "Save_Param_Search");
    lr_save_string(LB[count], "LB_SEARCH");

    web_reg_save_param("{Save_Param_Search}",
    "LB={LB_SEARCH}",
    "RB=tr",
    LAST);
    count += 1;


    If there is no easy answer I might as well just do it long hand.. at least that makes it easy to read I guess ;-)

  10. #10
    Moderator JakeBrake's Avatar
    Join Date
    Dec 2000
    Location
    St. Louis - Year 2025
    Posts
    15,609
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Using C and Loadrunner code for parameters

    How about using the built-in parameterization gadgetry? If you do you can eliminate any custom code related to that.

 

 
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
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.71%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 04:36 AM.

Copyright BetaSoft Inc.