SPONSORS:






User Tag List

Results 1 to 6 of 6
  1. #1
    Junior Member
    Join Date
    Nov 2001
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Testplan global variables

    How do I declare global variables within a testplan?
    Currently, I have an include file that contains some global variables used by several other include files within a script file. Rather than using an include file, I would like to let the user modify the testplan to define these global variables as needed(such as a server IP and some boolean values). Is there a way to declare those once in the Testplan and have all script files in the Testplan and all include files within the script files use those values?

    Thanks

  2. #2
    Senior Member
    Join Date
    Oct 2000
    Location
    Laurel, Maryland, USA
    Posts
    204
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Testplan global variables

    I do something similar to this in my test plans. At the top I have variables as follows:

    In my case all of my test cases are driven by the same high-level script, so I pass the variable into my test cases as follows:

    My 'CycleDriver' script calls another function which sets global variables with the values that are passed in. For this example I have a global variable called Database which I set with the value that is passed in.

    This way the user can set the values to whatever they desire right in the testplan.

    ------------------
    Atlee
    Atlee

  3. #3
    Super Member
    Join Date
    Jul 2001
    Location
    Earth
    Posts
    1,882
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Testplan global variables

    You can also declare variable in TestPlanEnter....... These are new recovery system functions in ST5.5

    ------------------
    James Soderborg
    http://www.ameliortech.com
    jamesso@ameliortech.com

  4. #4
    Junior Member
    Join Date
    Nov 2001
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Testplan global variables

    I tried Atlee's approach and may end up going that route. However, in my case the file must still exist with variables already set for cases where I'm not using a testplan. Which means that my function which sets the values passed in from the testplan would require reading in each line of the file, then doing some string manipulation and writing it back out. That's do-able but I was wondering what James is talking about with TesplanEnter? I can't find anything in the "help" for this and I'm running ST5.5. Is it documented somewhere or how do I use it? If it's similar to scriptEnter or testcaseEnter, then what would be different about it than going with Atlee's approach? Wouldn't I still have to pass those values in to a script that testplanEnter would use?

  5. #5
    Senior Member
    Join Date
    Oct 2000
    Location
    Laurel, Maryland, USA
    Posts
    204
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Testplan global variables

    How about a combination approach using .ini files? Define the globals in a .ini file, and when a testcase is executed which takes in the same globals from the plan go ahead and set the values in the .ini file. Then any test case (either stand-alone or driven from a plan file) executed reads the values from the .ini file and not from the global environment.

    If you haven't worked with .ini files (I haven't done this before) see IniFileOpen, IniFileGetValue, IniFileSetValue, and IniFileClose. These should do the trick if you decide to use them.

    ------------------
    Atlee
    Atlee

  6. #6
    Junior Member
    Join Date
    Nov 2001
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Testplan global variables

    Atlee,
    I had looked at using .ini files because you can set and get specific values without having to parse a string to get it.
    Unfortunately we use these particular global values in a lot of our tests and make decisions based on those settings so I would have to read the .ini file in every one of those cases. With the globals in a .inc, they are always resident in memory.

    Using your idea to pass in the values from the testplan to a script that can modify those values, we can keep our existing code as is.

    Thanks for the help!

    James - I've seen mention of TestplanEnter in other postings but I still haven't come across any documentation for using it. Where can I get some info on this?

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin 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 06:01 AM.

Copyright BetaSoft Inc.