Forum Discussion

anandkumar's avatar
anandkumar
Contributor
13 years ago

how to control execution of script to a fixed time line

Hi



i just want my TC script to run for 10mins only. if it runs more than that time just i want to stop it displaying an error msg.

eg. if my script starts executing at 10 am it should any how stop before 10.10 am and never run after that.

how can i implement this.

9 Replies

  • Hi Ncoes



    thanks for ur reply. prob is i cant put a check on time after each and every statement. so how can i handle this to monitor the execution every second.
  • irina_lukina's avatar
    irina_lukina
    Super Contributor

    Hi Amand,


    I recommend that you create a test item and assign your script to this test item. After that, you can set the maximum execution time (in minutes) for the created test item. For this purpose, use the Timeout column of the Test Items page.


    For more information on the described approach, please refer to the Terminating Tests on Timeout help topic. I hope this information helps :)

  • Hi Irina



    Thanks for ur reply. i bit confused using it. i set the test item timeout to 1min. but still it keeps on running after 1min also. how to call the ontimeout method?  if u have an example for that can u plz post it. it would be of great helpful.
  • Hi Irina,



    Thanks for ur reply. yes i did as u mentioned.

    -set the timeout to be 1min for the test item

    -added ontimeout event handler

    and following is the code i used to test it



    Sub GeneralEvents_OnTimeout(Sender, Params)

      Runner.Stop

    End Sub



    sub test

      delay 70000

      msgbox "hai"

    end sub



    but when i run this 'test' routine its not going to the ontimeout handler at all. just keeps on executing more than 1min. how to make it perfect?
  • irina_lukina's avatar
    irina_lukina
    Super Contributor

    Hi Amand,


    but when i run this 'test' routine its not going to the ontimeout handler at all


    I guess, I know what is wrong :) . To rise the OnTimeout event, you need to add the Test routine to the Test Items page, and then run the entire project, but not the routine. For this purpose, right-click the project node in the Project Explorer panel and select Run from the ensuing context menu.


    Does it work now?

  • Hi Irina,



    yes it helped and its of great help to me.



    Thank u very much :)