SPONSORS:






User Tag List

Results 1 to 8 of 8
  1. #1
    Senior Member
    Join Date
    Sep 2000
    Posts
    159
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Passing record to test case ()

    So far,I've been working with testplan editor and invoking scripts from the testplan.

    I have not studied the "main()" method yet.

    I want to initialize and create a record once and use the same record within many testcases.

    Is it possible to continue with the Testplan method and do something similar to folowing:

    myplan.pln

    [-] UserInfo
    [ ] script: myscript.t
    [ ] testcase: GetUserInfo ()

    myscript.t

    [-] type USERINFO is record
    [ ] STRING sUserName
    [ ] STRING sDB_Password

    testcase GetUserInfo (USERINFO data)


    I think I'm having compile problems on initializing the record.
    I want to do it once in my .t file outside all of the testcases.


  2. #2
    Senior Member
    Join Date
    Aug 1999
    Location
    MA
    Posts
    129
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Passing record to test case ()

    I noticed a couple of things.

    1) In myplan.pln, do this:
    When the () is used, then it will not process any arguments! You would see this if you tried to data drive from the plan level.

    2) If you want to have a global record, then you don't need the (USERINFO data) argument in the testcases. Add lines:
    In your testcases, you can directly reference data.

    Note: this is really not a good way to be coding, as the data record is global, and writeable. A testcase can change it, breaking further tests.

    Read about "Data Driven Testcases" in the SilkTest User's Guide to learn a better way, to pass in the data from the plan file, using the testdata: keyword. You could use the same "testdata" for all tests (you'd have to put the arguments back in the testcase though...)
    Steven Tyler
    Manager - Performance Engineering

    Kronos Incorporated
    tel: +1 978 947 4219

  3. #3
    Senior Member
    Join Date
    Mar 2000
    Location
    Dublin, Ireland
    Posts
    152
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Passing record to test case ()

    Hi Raul,

    You may want to try something like the following,

    name.inc:
    [-] type NAME is record
    [ ] string sFirstName
    [ ] string sLastName

    name.t:
    [ ] use "name.inc"
    [ ]
    [-] testcase PrintName (in NAME MyName)
    [ ]
    [ ] Print (MyName.sFirstName)
    [ ] Print (MyName.sLastName)

    name.pln:
    [-] Print out first and last name
    [ ] testdata: {"John", "O'Neill"}
    [ ] script: name.t
    [ ] testcase: PrintName

    When you run this testcase from the test plan, the output should be,

    [-] Print out first and last name
    [ ] John
    [ ] O'Neill

    I hope that this example help.

    John.



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

    John O'Neill.
    Quality Automation Ltd.
    www.quality-automation.com
    John O'Neill.
    Quality Automation Ltd.
    www.quality-automation.com

  4. #4
    Member
    Join Date
    Jan 2001
    Location
    Fairfield, CT, USA
    Posts
    86
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Passing record to test case ()

    Thanks John O'Neill
    It works fine.

  5. #5
    Senior Member
    Join Date
    Sep 2000
    Posts
    159
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Passing record to test case ()

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by John O'Neill:
    I hope that this example help.


    <HR></BLOCKQUOTE>

    Thank You. That helps a lot.

    Is it also possible to pass the record
    in the name.pln ?

    Example:

    testdata: {MyName.sFirstName, MyName.sLastName }

  6. #6
    Senior Member
    Join Date
    Mar 2000
    Location
    Dublin, Ireland
    Posts
    152
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Passing record to test case ()

    You would have to initialise the record in your include file or script file first,

    name.inc or name.t:
    [ ] NAME MyName = {"John", "O'Neill"}

    name.pln:
    [-] Print out first and last name
    [ ] testdata: {MyName.sFirstName, MyName.sLastName}
    [ ] script: name.t
    [ ] testcase: PrintName

    or,
    [-] Print out first and last name
    [ ] testdata: MyName
    [ ] script: name.t
    [ ] testcase: PrintName

    Regards,

    John.



    [This message has been edited by John O'Neill (edited 02-08-2001).]
    John O'Neill.
    Quality Automation Ltd.
    www.quality-automation.com

  7. #7
    Senior Member
    Join Date
    Jul 1999
    Location
    Burlingame CA 94010
    Posts
    502
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Passing record to test case ()

    Defining records in a testplan is cumbersome and not very easy to do. Its easier to define the record in a script or include file, then pass it from the plan to your testcase. For example

    register.t
    type Cust is recrord
    STRING sName
    INTEGER iAccount

    Cust cOne = {...}
    "Hart"
    1358093

    register.pln
    Register Existing
    script: register.t
    testcase: VerifyRegisterExisting
    testdata: cOne


    Even variables which are extremely complex records and lists of records can be passed from the plan to the script where the variables are actually defined.

    Hope this helps.


    ------------------
    John W Green
    jwgreen@automationexpertise.com
    http://www.automationexpertise.com

  8. #8
    Senior Member
    Join Date
    Sep 2000
    Posts
    159
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Passing record to test case ()

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by John Green:

    Even variables which are extremely complex records and lists of records can be passed from the plan to the script where the variables are actually defined.

    Hope this helps.


    <HR></BLOCKQUOTE>

    One big limitation of the Test Plan seems to be that testcases cannot share values of Global variables.

    All global variables get re-initialized after each testcase.

    I have to write values to files in order
    for other testcases to read global variables.

    This seems like a big pain.

 

 

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 10:44 AM.

Copyright BetaSoft Inc.