SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 4 of 4

Thread: lr_whoami

  1. #1
    Member
    Join Date
    Aug 2002
    Posts
    253
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    lr_whoami

    Does lr_whoami do any good?

    I'm trying to create a switch statement based on vuser_number, but it seems as though no matter how many vusers I run, the vuser_id is always == 45.

    <font class="small">Code:</font><hr /><pre>
    lr_output_message("This is vuser_id %d", lr_whoami);
    </pre><hr />

    Unless I do this, in which case I get the vuser_id == -1

    <font class="small">Code:</font><hr /><pre>
    lr_whoami(&amp;id, NULL, NULL);
    lr_message( "vuser id: %d", id);
    </pre><hr />

    Crazy, eh? Maybe I'm doing something wrong, but I don't know what it could be.

    So I think I'll probably just need to create a parameter based on vuser_number and use else if statements (I seem to remember case only takes constants).

    But shouldn't lr_whoami return the vuser_number, as determined by the sequential order in which the vusers started? The help on lr_whoami is very unhelpful.

  2. #2
    Apprentice
    Join Date
    Oct 2007
    Posts
    34
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: lr_whoami

    As the help of lr_whoami suggests,

    int id, scid;
    char *vuser_group;

    lr_whoami(&amp;id, &amp;vuser_group, &amp;scid);
    lr_message( "Group: %s, vuser id: %d, scenario id %d",

    vuser_group, id, scid);


    Note that memory for vuser_group is allocated automatically. Do not alter the string.


    So this should be the way in which lr_whoami has to be used.

    Otherwise you can use the parameter type VUserID for getting the VUser number.

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

    Re: lr_whoami

    Very likely I would just use a parameter with the virtual user number and construct the switch statement based upon an evaluation of

    int my_eval_var=atoi(lr_eval_string("{my_vuser_number_ param}"))

    It might make it easier to check the conditions of the switch statement as well since you could assign a static value to the my_eval_var variable in script development
    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
    Member
    Join Date
    Aug 2002
    Posts
    253
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: lr_whoami

    Yeah, seems like lr_whoami may simply be broken, or maybe it's just used to assign a vuser id, rather than read it.

    Oh well, doesn't really matter; I'll just use the vuser parameter option.

    But it's always good to get this fact documented on this site in case anyone is wondering the same thing in the future (especially if I forget and that person is me!).

 

 

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 © 2016 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 © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 02:44 AM.

Copyright BetaSoft Inc.