SPONSORS:






User Tag List

Results 1 to 10 of 10
  1. #1
    Senior Member
    Join Date
    Sep 2001
    Location
    Dublin
    Posts
    232
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Using a function to loop a .t multiple times

    Hi guys,
    This is what I am after.
    I have created a large test script and would like to get some function or whatever so that I can recall the whole .t to execute over an x amt. of times. The complete scripts can be called and ran say 100 times in succession ?
    Has anyomne done thos or knows how to ?
    Thanks,


    ------------------
    ================
    Thanks,
    Tomás.

    Quis Custodiet ipsos custodes

  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: Using a function to loop a .t multiple times

    Well, a crude yet simple way of doing this would be to create a Suite (.s) file and put the .t file into it 100 times. Suite files are fairly archaic, but they do work.

    - Dave


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

  3. #3
    Senior Member
    Join Date
    Sep 2001
    Location
    Dublin
    Posts
    232
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Using a function to loop a .t multiple times

    Thanks Dave, but another crude remark is, what is a .s file and how do I create one ?

    ------------------
    ================
    Thanks,
    Tomás.

    Quis Custodiet ipsos custodes

  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: Using a function to loop a .t multiple times

    Yeah...I guess they are a bit old-fashioned.

    In SilkTest, from the File Menu, select the New MenuItem. On the subsequent DialogBox, select "Suite" from the RadioList and click OK.

    You'll get a blank file. All you have to do is put in there the .t file that you want it to execute. If you save it in the same directory as your .t file, the directory is not necessary. In your case, you want to specify the .t file in there 100 times.

    Suite files are, pretty much, just batch files for test scripts. No logic, no programming. When you run the .s file, SilkTest will run the main function in every specified .t file. Or, if there is no main function, every testcase in every .t file.

    Better?

    - 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
    Sep 2001
    Location
    Dublin
    Posts
    232
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Using a function to loop a .t multiple times

    Cheers Dave, just been doing this a short period....so it's a matter of copying in the .t, do I need to include the .t name alos in side ?
    Do I run this internally also then from menu ?

    Appreciated man...

    ------------------
    ================
    Thanks,
    Tomás.

    Quis Custodiet ipsos custodes

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

    Re: Using a function to loop a .t multiple times

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by ThomasO:
    Cheers Dave, just been doing this a short period....so it's a matter of copying in the .t, do I need to include the .t name alos in side ?
    Do I run this internally also then from menu ?

    Appreciated man...

    <HR></BLOCKQUOTE>

    Oh...great. Now you're gonna tax my memory.

    Okay, here's a short Suite that I just created that'll probably look something like yours:
    Pretty boring, huh? It'll just run that script four times in a row.

    And here are what the results look like:
    Just use the big green arrow on the toolbar to run the Suite. Or you can do it from the Run command on the File Menu; however, by default, that'll only show you .t files. You'll have to choose "Suite Files" from the Files of Type at the bottom.

    Cheers, huh? So where in England are you?

    - Dave

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

  7. #7
    SQA Knight
    Join Date
    Jul 1999
    Location
    Grand Rapids, MI
    Posts
    3,727
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Using a function to loop a .t multiple times

    A simpler method for executing a testcase X number of times is to place a main() function at the top of the *.t file, as in:



    [The leading "periods" in the above example are only there to allow an empty newline, for code clarity].

    The main() function, when it exists in a *.t file, will always be executed by Silk's runtime agent, rather than ANY testcase found in the file--therefore you MUST explicitly call any and all testcases you wish to execute from main() when it is used. [This gives you a lot of conditional control over say, executing one testcase versus another, depending on an environment or machine state that is initially tested for].

    The life and influence of a main() in one *.t does not effect any other *.t file, therefore [and this seems strange to C programmers] there may be a main() function in any number of *.t files, even when they are all called by a *.s file [a Suite file].

    Depending on your siutation you may want to terminate the main() for loop if the testcase fails, and you will probably want to print a pass message each time the testcase is called [in order to have the fact that it executed 100 times in your log file].

    The main() function used in this manner used to be very common in old QA Partner code examples, but in recent years it seems to have been dropped from the documentation.

    -Hope this helps, Terry Horwath


    [This message has been edited by Terry Horwath (edited 09-21-2001).]

  8. #8
    Senior Member
    Join Date
    Sep 2001
    Location
    Dublin
    Posts
    232
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Using a function to loop a .t multiple times

    Thanks for all the help, I am not from England....Ireland....
    Appreciate that lads...ta

    ------------------
    ================
    Thanks,
    Tomás.

    Quis Custodiet ipsos custodes

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

    Re: Using a function to loop a .t multiple times

    You could also call a function, passing the testcase name, and the number of times to run it as arguments. You call the testcase from within the function as follows:

    RunMultiple (STRING sTestcase, INTEGER iTimes)

    INTEGER i

    for i = 1 to iTimes
    @(sTestcase) ()

    Hope this helps.



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

  10. #10
    Senior Member
    Join Date
    Sep 2001
    Location
    Dublin
    Posts
    232
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Using a function to loop a .t multiple times

    Cheers....have it looping here....

    ------------------
    ================
    Thanks,
    Tomás.

    Quis Custodiet ipsos custodes

 

 

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:24 PM.

Copyright BetaSoft Inc.