SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 10 of 10
  1. #1
    SQA Knight
    Join Date
    Sep 2001
    Location
    Bangalore,India
    Posts
    2,549
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Controlling execution time

    Hi All,

    Sometimes Scripts are not executed unattended due to AUT hang or waiting for long time. I'm looking a feature to control the test case execution by the given time. I meant that few test cases has to be executed within 15 minutes and test case should go to TestcaseExit, if the execution is beyond 15 minutes .

    Is it possible in Silktest?
    Thanks & Regards,
    Palani.
    http://tips-testing.blogspot.com/index.html
    Quote: Donít hesitate to initiate!

  2. #2
    Advanced Member
    Join Date
    May 2005
    Location
    Fremont, CA
    Posts
    832
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Controlling execution time

    Palani,

    I think I found an answer for you...

    Here's what you do:
    1) you execute all your code on a separate thread
    2) While your code is executing you are checking if a timeout is met and if it is, you exit the testcase...

    Here's an example:
    <font class="small">Code:</font><hr /><pre>
    [-] void main ()
    [-] spawn
    [ ] Notepad.Exists (10)
    [ ] print ("Thread completed")
    [ ]
    [ ] int i = 0
    [ ] int timeout = 5
    [-] while (i &lt; timeout)
    [ ] sleep (1)
    [ ] print ("i={i}")
    [ ] i++
    [-] if (i == timeout)
    [ ] print ("exiting out of the testcase since it takes too long to complete")
    [ ] exit
    [ ] rendezvous
    [ ]
    [ ] print ("all done!")
    </pre><hr />

    hope this helps.

    dimaj

  3. #3
    Member
    Join Date
    Aug 2006
    Posts
    152
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Controlling execution time

    I have a similar approach to that of dimaj but a different logic.

    Instead of spawning your code in each of those testcases (which can be very time consuming) I recommend you to spawn the function that will keep track of the execution time taken for each of the testcases. This is how it will look like

    <font class="small">Code:</font><hr /><pre>
    [-] testcase Trial ()appstate none
    [ ] /// This will start a new thread which will keep track of your time.

    [-] spawn
    [ ] CheckExecutionTime()
    [ ]
    [ ] /// Actual testcase code will start from here
    [ ] int iCount=1000
    [ ] Notepad.SetActive()
    [+] while(iCount&gt;=0)
    [ ] Notepad.TextField1.ClearText()
    [ ] Notepad.TextField1.SetText("{iCount}")
    [ ] iCount--
    [ ]
    [ ]
    [ ]
    [ ] /// Function
    [-] void CheckExecutionTime()
    [ ] HTIMER Timer
    [ ] Timer = TimerCreate ("TimerName")
    [ ] TimerStart (Timer)
    [ ]
    [-] while(TimerStr(Timer)!="4.000") /// Depending on your testcase you can set this to 15mins or any other value
    [ ] // Continue
    [ ]
    [ ] print("Timer reached {TimerStr(Timer)}")
    [ ]
    [ ] TimerDestroy (Timer)
    [ ]
    [ ] exit
    [ ]

    </pre><hr />

    Hope this helps ...

    2lz

  4. #4
    SQA Knight
    Join Date
    Sep 2001
    Location
    Bangalore,India
    Posts
    2,549
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Controlling execution time

    Thanks for your replies. I'll verify these ideas.
    Thanks & Regards,
    Palani.
    http://tips-testing.blogspot.com/index.html
    Quote: Donít hesitate to initiate!

  5. #5
    Senior Member
    Join Date
    May 2007
    Location
    LantianCity
    Posts
    103
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Controlling execution time

    It also very useful for me, thanks!
    It never rains but it pours.
    Welcome to visit: <font color="blue">www.lantianwei.com</font>

  6. #6
    Senior Member
    Join Date
    Feb 2006
    Location
    Princeton, NJ
    Posts
    195
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Controlling execution time

    To accomplish this task in multithreads you would need separate agent(machine) for each concurrent thread. According to help you will get runtime error, if try to spawn parallel threads on a single machine. In your case you will need another machine to check the execution time, which is not very efficient.

  7. #7
    Advanced Member
    Join Date
    May 2005
    Location
    Fremont, CA
    Posts
    832
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Controlling execution time

    April,

    You are correct... I got that as well when I was testing the code I posted. What 2lz and I are doing here is just spawning another thread without any target (localhost).
    When I was testing my code, I got run-time errors when I attempted to connect to a machine.

    Hope this kinda clears your doubts about this method.

    dimaj

  8. #8
    Senior Member
    Join Date
    Feb 2006
    Location
    Princeton, NJ
    Posts
    195
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Controlling execution time

    Dimaj,
    you will not get an error, if you connect to multiple machines and then spawn parallel threads on those: one thread per machine. Besides I found that using parallel statement instead of spawn... rendezvous makes code more readable and reliable - I was getting runtime errors (something about siblings) with spawn..rendezvous and not with the same code using parallel.

  9. #9
    Advanced Member
    Join Date
    May 2005
    Location
    Fremont, CA
    Posts
    832
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Controlling execution time

    April,

    well... if you want to run your code simultaneously on multiple machines, then yes, you will use spawn/parallel...rendezvous. (By the way, rendezvous is optional. it is used only for the thread synchronization.)

    I guess what I was trying to say earlier that if you make some connections prior to the spawning, your threads will run on different agents. However, if you don't connect to other computers, everything will work asynchronously.
    You can always try either mine or 2lz's examples and see that they do work per Palani's requirements.

    dimaj

  10. #10
    SQA Knight
    Join Date
    Sep 2001
    Location
    Bangalore,India
    Posts
    2,549
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Controlling execution time

    Hi Guys,
    Thanks for your help. I'm able to implement it for this query Kill the application after certain time .
    Thanks & Regards,
    Palani.
    http://tips-testing.blogspot.com/index.html
    Quote: Donít hesitate to initiate!

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.00%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin 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 09:54 AM.

Copyright BetaSoft Inc.