SPONSORS:






User Tag List

Results 1 to 7 of 7
  1. #1
    Member
    Join Date
    Aug 2000
    Location
    oakland,ca,u.s.a
    Posts
    38
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do I exit a testcase programmatically?...

    I know that I can use the "exit" statement but that exits the entire script if I'm calling testcases from main()

    e.g.
    test1(boolean b)
    print("hello world")
    if b
    exit
    else
    print("goodbye")


    main()
    test1(TRUE)
    test2()

    In this case, test2() will not run I would like to return from test1() prematurely and programmatically on certain conditions with a "passed" result for test1() and then continue to test2().

    Can't I call some function like TestCaseExit() or something?

    thanks,
    Dave
    Dave
    QA Engineer
    CareBid.com

  2. #2
    Senior Member
    Join Date
    Sep 1999
    Location
    San Jose,CA,USA
    Posts
    340
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How do I exit a testcase programmatically?...

    Substitute return for
    exit .. it'll work!
    Smoke me a kipper, I'll be back for breakfast!
    Sincerely
    Richard Weth
    Sr. QA Engineer

  3. #3
    Member
    Join Date
    Aug 2000
    Location
    oakland,ca,u.s.a
    Posts
    38
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How do I exit a testcase programmatically?...

    I did that already, yes it works, but did you notice it doesn't appear to use the recovery system? i.e. restoring base state on exit?

    Dave
    QA Engineer
    CareBid.com

  4. #4
    Senior Member
    Join Date
    Aug 1999
    Location
    San Diego, CA USA
    Posts
    219
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How do I exit a testcase programmatically?...

    If you are using the Silk recovery system (each testcase is defined with "appstate DefaultBaseState" or "appstate BaseState" and NOT with "appstate none") then there is no reason you should not be able to put your ResCloseList () in TestCaseExit. This of course assumes that you have TestCaseExit defined in your frame file.

  5. #5
    Senior Member
    Join Date
    Sep 1999
    Location
    San Jose,CA,USA
    Posts
    340
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How do I exit a testcase programmatically?...

    Yes that is true. Two things:
    (1) I really never "bought in" on app states myself (it's a question of style really)

    (2) I assume that the base state for the second test .. test2 will take care of that for you.

    However having said that if you still don't get what you need here you may want to look at test organizer for supplanting this functionality.

    Again I know I don't leverage every nuance of Silk functionality out there. To me at the heart of the matter is .. can I reliably automate tests, and can I come up with a cohesive design for implementing test goals for my organization.

    So I was personally always very happy with return. However I know it is always attractive to leverage the architecture as it stands whenever you can.


    Smoke me a kipper, I'll be back for breakfast!
    Sincerely
    Richard Weth
    Sr. QA Engineer

  6. #6
    Member
    Join Date
    Aug 2000
    Location
    oakland,ca,u.s.a
    Posts
    38
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How do I exit a testcase programmatically?...

    Rick, That's true the next testcase will set it's own base state so it's kind of redundant to have a base state set on entrance and exit. Return seems to work fine.

    Regarding the ResCloseList(): If I study where the ResOpenList() calls appear and carefully place ResCloseList() before return statments it avoids the nesting results problem, only problem is when there's an exception.

    I suppose that if I define my own TestCaseExit() function, I can then call the ResCloseList(), but only problem is you never know where an exception could occur so it may turn out that there is no open list so calling ResCloseList will throw another exception.

    Calling DefaultTestCaseExit() gives "Wrong number of arguments error". I can't find a definition of the required args in the SilkTest help or reference. I think it wants some exception list or something.
    Dave
    QA Engineer
    CareBid.com

  7. #7
    Member
    Join Date
    Sep 2000
    Posts
    31
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How do I exit a testcase programmatically?...

    Instead of calling the Return() function why don't you just call DefaultTestCaseExit() (or TestCaseExit() if you have written your own) that way it will perform the cleanup that you are looking for.

 

 

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 12:19 PM.

Copyright BetaSoft Inc.