Stop current test (or thread)?

5 posts, 0 answers
  1. Peter
    Peter avatar
    1 posts
    Member since:
    Nov 2010

    Posted 09 May 2011 Link to this post

    Hey all,

    I have a third party app that I am currently working on that will run a few of our basic WebAii tests.  I have a button that when a user clicks, it should stop the execution of the tests being run.  This sort-of works, but I want to know if there is a way to stop any current execution of any webaii calls? 

    What I do currently is call manager.Dispose() and that will close my browser, causing the test to fail.  I don't like this approach, and would rather be able to say manager.StopCurrentTest() (or something like that)then handle the tests being aborted, then call my manager.Dispose().

    Is there any hack to do this?

    Thanks!

  2. Alexey Ivanov
    Alexey Ivanov avatar
    45 posts
    Member since:
    Sep 2009

    Posted 10 May 2011 Link to this post

    Hello,

    To stop execution of any webaii calls you should kill the test runner proccess (for example, nunit-console.exe)

  3. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 12 May 2011 Link to this post

    Hello Peter Pan,

    That is a fair question. There really isn't a better way, but I would like to suggest an alternative. First I'm assuming you spawned a secondary thread (a worker thread) to execute the test separate and independent from your UI thread. Have your UI thread set or clear some sort of a global RUN flag when your Stop/Abort button is clicked. Then have your testing thread periodically check this flag. When they see it set they should throw an assert. Any assert will do. That will cause the test to stop right there and do a full and proper cleanup.

    Regards,
    Cody
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  4. Peter
    Peter avatar
    1 posts
    Member since:
    Nov 2010

    Posted 13 May 2011 Link to this post

    Hey Cody, thanks for the response.  I implemented something similar to what you suggested.  I basically have a ExecuteTest method, in which I first check to see if a cancel test flag is set, if it's not, the test will run.  When the user presses the Stop Test button I set the flag to true, and immediately call a close browser(s) command, which in turn will cause my running test immediately fail.  Now that my flag is set to true, all other tests will be skipped.
  5. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 18 May 2011 Link to this post

    Hello Peter,

    That sounds like a very good solution to me. I am glad to see you came up with this!

    Greetings,
    Cody
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top