SPONSORS:






User Tag List

Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Senior Member
    Join Date
    Dec 2001
    Location
    Bozeman, MT, USA
    Posts
    265
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    dynamic \'use\' statement

    I want to have a dynamic use statement. We are developing a test frame for a plugin to a major application. This plugin is supposed to work on 3 different versions of the application and thus I want to have 3 different include files. For instance if I have an include file called VersionOne.inc, VersionTwo.inc, and VersionThree.inc and I want to load the respective include file depending on the version of the product in the registry. If the registry says that the product version is 3 I want to load VersionThree.inc.

    Here is the problem, the include file in a use statement must be a constant. Is there any way around this? Does any of this make sense? Thanks.

    ------------------
    Ryan McCullough
    RightNow Tech. Inc.

  2. #2
    Senior Member
    Join Date
    Jul 2001
    Location
    Westford, MA, USA
    Posts
    160
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: dynamic \'use\' statement

    I suppose one low-tech way would be to put the use statement, whichever applies for the AUT version you're testing, in the "Use Files" field in Options - Runtime. Something a little more fancy would involve writing to the partner.ini file, so you don't have to go into SilkTest and type in the information manually every time you switch.

    Most people write just one .inc file, or set of .inc files, and put a function call in each window's tag. The function checks the version of your AUT and returns the appropriate string to the tag statement.

    Maybe I'll think of some more ways later.


    ------------------

  3. #3
    Senior Member
    Join Date
    Jul 1999
    Location
    Bellingham, WA USA
    Posts
    1,323
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: dynamic \'use\' statement

    I'm just brainstorming here rather than offering a well though out response, but could you have one "mini" include file with a function that queried the registry for the version of your app, and based on the returned value, made another call to use the appropriate larger include file?

    Wait ... (brainstorm continues) that may have some issues for the compile... Well, it is a direction I would probably investigate and see if it could be made workable.

    ------------------

  4. #4
    KS
    KS is offline
    Senior Member
    Join Date
    May 2001
    Posts
    265
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: dynamic \'use\' statement

    Did you think about using Compiler Constants or Options Set file?

    ------------------

  5. #5
    Senior Member
    Join Date
    Dec 2001
    Location
    Bozeman, MT, USA
    Posts
    265
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: dynamic \'use\' statement

    Right now I am using a compiler constant for the version and the include filename is a constant string with the compiler constant inserted in there as well. So I have:

    //***************
    compiler constant: cVersion = "Two"

    const string sIncludeFile = "Version{cVersion}"

    use "{sIncludeFile}"
    //***************

    And this works, but my boss doesnt like it because the people running the scripts dont know very much about silk other than to open the test plan and hit run, let alone modify compiler constants.

    I had done as DJGray mentioned and made a function that would query the registry(which was actually a pill with 5.5 sp1, had to get an extra include file from segue tech support. More on this latter) and return the version and based on that version would return a string of the version to concatenate into the include string.

    When I compiled I would get a compile error that a use statement must be a constant string and since I was calling a function it didnt think it was constant. I know I have called functions before though to initialize const string's. I think it has something to do with the order I was doing things but I dont know. I tried for a while to make this work and couldnt. Maybe I need to have the use statement in my function that queries the registry?

    Does this information help? Anything else you guys need to know about my situation? Right now I have something that works but Ideally the version could be picked up on the fly not worrying about the computer it is on, os thats running, or version of the master app. Thanks in advance for your help.

    -Ryan McCullough

    ------------------
    Ryan McCullough
    RightNow Tech. Inc.

  6. #6
    Senior Member
    Join Date
    Dec 2001
    Location
    Bozeman, MT, USA
    Posts
    265
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: dynamic \'use\' statement

    oops, visualize a ".inc" at the end of sIncludeFile in the previous post.

    ------------------
    Ryan McCullough
    RightNow Tech. Inc.

  7. #7
    Senior Member
    Join Date
    Jan 2001
    Posts
    750
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: dynamic \'use\' statement

    Can;t you do something like

    //do your regedit here
    use common.inc
    if (thisVersion)
    use version1.inc
    else
    if(otherVersion)
    use version2.inc



    ------------------

  8. #8
    Junior Member
    Join Date
    Oct 2001
    Posts
    7
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: dynamic \'use\' statement

    One solution is to open the optionset file just before executing the testscript. Silk provides the option to load optionset file through plan file(the key word is optionset In this optonset declare the compiler constant.

    HTH
    -srikanth

    ------------------

  9. #9
    Senior Member
    Join Date
    Dec 2001
    Location
    Bozeman, MT, USA
    Posts
    265
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: dynamic \'use\' statement

    how do you declare a compiler constant in code? using the const statement?

    ------------------
    Ryan McCullough
    RightNow Tech. Inc.

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

    Re: dynamic \'use\' statement

    Compiler constants are entered in through the Runtime options dialog in SilkTest. The values are stored in partner.ini

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

 

 
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
  •  

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 02:11 AM.

Copyright BetaSoft Inc.