SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 3 of 3
  1. #1
    Senior Member
    Join Date
    Jun 2002
    Location
    NYC area
    Posts
    463
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Passing strings between VUs

    Does anyone have any ideas on how to pass a string variable between different VUs during test execution? I don't have any problems with integer values, but can't seem to pass a string.
    Per the help file on the function "AttributeSetString" This should allow passing a string via a project attribute.
    But what happens for me is I can retrieve it from the user who sets it, but any other users pick up nothing when executing "AttributeGetString".
    Here's the simple code I'm testing:
    User setting attribute:
    <font class="small">Code:</font><hr /><pre>
    GetDirectory(DIRECTORY_RESULT,gsRsltDir,STRING_COM PLETE);
    Print("Initial Result Folder= " +gsRsltDir ,-1,Text_Black);
    strrev(gsRsltDir);
    StrSearchDelimited(fsDirTemp,STRING_COMPLETE,gsRsl tDir,"_",1,"\\",1,STR_SEARCH_FIRST);
    StrSearchDelimited(fsLoadTest,STRING_COMPLETE,gsRs ltDir,"\\",1,"_",1,STR_SEARCH_FIRST);
    strrev(fsDirTemp); strrev(fsLoadTest);
    Print("Parsed Loadtest string is: " +fsLoadTest,-1,Text_Black);
    Print("Parsed Result Folder string is: " +fsDirTemp,-1,Text_Black);
    gnLoadTest := number(fsLoadTest);
    // gsRsltDir := fsDirTemp;
    GlobalVarSet("gblLoadTest",number(fsLoadTest));
    AttributeSetString("gblRsltDir", fsDirTemp);
    AttributeGetString ("gblRsltDir", gsRsltDir);
    GlobalWaitFor("tInitSetup",ALL_USERS);
    </pre><hr />
    And here's where I try to retrieve it:
    <font class="small">Code:</font><hr /><pre>
    GlobalWaitFor("tInitSetup",ALL_USERS);
    AttributeGetString ("gblRsltDir", gsRsltDir);
    Print("User Folder Attribute from Remote Host VU is: "+gsRsltDir,-1,Text_Blue);
    Print("LoadTest # from Remote Host VU is: "+string(gnLoadTest),-1,Text_Blue);
    </pre><hr />

    My only other idea is to write the value to a text file and retrieve it from the other users. Or possibly write it to a DB and retrieve it from there, but neither one of those options is very appealing.
    Thanks
    Yes, it really IS rocket science!
    http://www.linkedin.com/in/doncobos

  2. #2
    Senior Member
    Join Date
    Nov 2008
    Location
    London, England
    Posts
    183
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Passing strings between VUs

    AttributeGetString and AttributeSetString are for getting and setting user attributes and as such the behaviour you are seeing is what I would expect.

    What difference is there in the value of the directory between users? Could you not just set this as a global variable at the start of the script?

    I have used the text file method in the past to write values and then have different users pick them up. Its not too tricky.
    The shortest distance between two points is under construction.

  3. #3
    Senior Member
    Join Date
    Jun 2002
    Location
    NYC area
    Posts
    463
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Passing strings between VUs

    [ QUOTE ]
    AttributeGetString and AttributeSetString are for getting and setting user attributes and as such the behaviour you are seeing is what I would expect.

    [/ QUOTE ]
    In looking further into this on the Borland KB I saw that you can only pass string attributes back and forth between users if you're using Java framework scripts. It does still irritate me that you can pass a number between VUs but not a string.
    [ QUOTE ]
    What difference is there in the value of the directory between users? Could you not just set this as a global variable at the start of the script?

    [/ QUOTE ]
    The difference lies between the users on the controller get the 'actual' folder name whereas the users on agent machines only get a 'temp' folder name that is not the same.
    [ QUOTE ]
    I have used the text file method in the past to write values and then have different users pick them up. Its not too tricky.

    [/ QUOTE ]
    I agree but for some reason in the environment I'm working in now I'm having problems reading and writing to UNC paths. Rather than spend the time to figure that out I elected to write to and then read from my own DB since I already have that in place and working fine.
    Yes, it really IS rocket science!
    http://www.linkedin.com/in/doncobos

 

 

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 11.54%
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 09:45 PM.

Copyright BetaSoft Inc.