SPONSORS:






User Tag List

Results 1 to 5 of 5
  1. #1
    Junior Member
    Join Date
    Oct 2000
    Location
    UK
    Posts
    19
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to use a variable declared in .pln in a testcase

    I'm trying to figure out if it is possible to declare a variable in a testplan and then use the variable in a .inc or .t file without passing the variable as an argument to a testcase. If I reference the variable in the .inc or .t then obviously the compiler complains that I haven't declared the variable. If I declare the variable then the local copy is used.

    I'd like to be able to specify a number of variables in the .pln so that I can keep everything in one place instead of having to keep the variables in a file. I'm after letting the testplan user specify a machine name for a couple of machines without having to pass a structure into each testcase. Any ideas?

    Thanks,

    Andrew

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

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

    Re: How to use a variable declared in .pln in a testcase

    I can't think of any easy way to do it without an argument being passed to the testcase. Unfortunately, SilkTest scripts are completely ignorant of a test plan having called them at all.

    There are a couple of ugly workaround possibilities.

    If the .t is the same name as the .pln I suppose you could use GetProgramName in the script to find the name, alter the .t to .pln, and use SilkTest to read the .pln file for a variable. Very messy.

    You could also create option sets and specify variables in the compiler constants. Then, in the testplan, you could switch to a different option set on the fly to load new variables.(see the "Specifying option sets" subheading under "testplan" in the SilkTest Help Index).

    Still, that's just about as messy as creating a .ini file to store the variables in. SilkTest reads from those pretty fast, and it's easy to keep things organized in there. Or, you could store everything in an Excel spreadsheet for even easier maintenance.

    Good luck.

    - Dave



    ------------------
    Amelior Technology
    dreed@ameliortech.com
    WaltzingRhino.com
    A concerned Borland customer, a fly in the ointment, a wrench in the works.

  3. #3
    Junior Member
    Join Date
    Oct 2000
    Location
    UK
    Posts
    19
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to use a variable declared in .pln in a testcase

    Dave,

    Thanks for the tip on compiler constants. The only problem with using the compiler constants is that a user has to define them for each of the option sets that are in use in the test plan. Since my tests use a mixture of web and windows GUI apps I use multiple option sets. It's a shame you can't define the compiler constants on the fly using a #define in a .pln as it would make them more visible to the end user and mean they would only be defined in one place.

    Andrew

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

  4. #4
    Senior Member
    Join Date
    Jul 2001
    Location
    Elizabeth, CO, USA
    Posts
    653
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to use a variable declared in .pln in a testcase

    Yeah, that would be handy. You could submit it as an enhancement request to Segue if you're feeling particularly masochistic.

    Personally, I'd go with either the .ini file or a spreadsheet. With those options, you could call a SilkTest testcase from the .pln file to set new values as needed. Some simple application state free testcaes that just does the data manipulation that all subsequent testcases will use.

    Something like this in the .pln file:

    [-] Set Values
    [ ] $sDataSet = "Global"
    [ ] $sField = "Name"
    [ ] $sValue = "Guido"
    [ ] script: setdata.t
    [ ]
    [ ] testdata: sDataSet, sField, sValue
    [ ] testcase: SetValues

    Whether that SetValues testcase does some .ini file manipulation or .xls manipulation is up to you. Then you could even use TestCaseEnter to read values from the database/ini file so that you don't have to add code to each testcase to read the data.

    That kinda thing has worked for me before, at least.

    - Dave


    ------------------
    Amelior Technology
    dreed@ameliortech.com
    WaltzingRhino.com
    A concerned Borland customer, a fly in the ointment, a wrench in the works.

  5. #5
    Senior Member
    Join Date
    Jun 2000
    Location
    Chicago, IL USA
    Posts
    383
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to use a variable declared in .pln in a testcase

    This is one of several reasons that we decided to abandon the ".pln" format.

    The testplan format is a very limiting straightjacket that is only useful for certain types of testing.

    Everything that plan files do for you can be
    done better with a good and disciplined testware structure in ".t" files.

    Liberating myself from that strange testplan syntax and the limitations of those "symbols" (not variables) has enabled me to go on to do amazing things with my testware.

    There is a lot of disagreement on this subject, depending on the kinds of testing people are doing. Search the archive for our previous discussions.

    ------------------
    Rob Kapteyn
    Rob Kapteyn, CSTE
    RobKapteyn@gmail.com

 

 

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 08:55 PM.

Copyright BetaSoft Inc.