SPONSORS:






User Tag List

Results 1 to 3 of 3
  1. #1
    Senior Member
    Join Date
    Jun 2000
    Location
    Sunyyvale CA USA
    Posts
    422
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Testcase thata ccepts parameters

    Any idea or example of a testcase that accepts variables as input parameters. I am looking like this,

    call loginDialog (param1, param2)

    here logindialog is testcase name and param1 and param2 are login and password. Will write testcase to handle like this or is itbetter to have a function to perform this. Appreciate yr inputs.


    ------------------
    Sree
    Sree

  2. #2
    AJ
    AJ is offline
    Moderator AJ's Avatar
    Join Date
    Jun 1999
    Location
    San Jose, CA
    Posts
    1,691
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Testcase thata ccepts parameters

    testcase foo1 (string sFName, string sLName optional)
    if sLName != null
    Print (sFName + " " + sLName)
    else
    Print (sFName)

    as simple as that...

    optional is a keyword which makes it possible to not pass a param. so you can call this function in either way:

    foo1("John") or foo1("John", "Smith")

    ------------------
    AJ Alhait
    BetaSoft Inc.
    AJ Alhait
    BetaSoft Inc.

  3. #3
    Senior Member
    Join Date
    Feb 2000
    Posts
    1,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Testcase thata ccepts parameters

    Besides the how-to question you ask: "Will write testcase to handle like this or is it better to have a function to perform this."

    It depends. Early on for simplicity, the answer is probably "testcase". However if logging on is merely a minor formality in a lengthy action sequence to perform some other test, it is probably better to write it as a function with a parameter that identifies an optional expected error. That way the function can be wrapped in a testcase to isolate it in the results listing, or used directly (more likely imbedded) in other routines.

    Since code duplication and test suite maintenance are the bane of automated test development, you should consider both consequences in what you write.

    So a roughly psuedo-coded function might be defined as

    login (param1,param2, sExpected optional)
    {
    User.SetText(param1)
    Password.SetText(param1)
    Login.OK.Click()
    if (errordialog.Exists() ...)
    {
    if (sExpected != NULL)
    // process the (un)expected error here...
    }
    }


    John

 

 

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 07:42 AM.

Copyright BetaSoft Inc.