This is a migrated thread and some comments may be shown as answers.

Stop current test (or thread)?

4 Answers 89 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 09 May 2011, 07:00 PM
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!

4 Answers, 1 is accepted

Sort by
0
Alexey Ivanov
Top achievements
Rank 1
answered on 10 May 2011, 11:02 AM
Hello,

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

0
Cody
Telerik team
answered on 12 May 2011, 10:59 PM
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
0
Peter
Top achievements
Rank 1
answered on 13 May 2011, 01:30 PM
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.
0
Cody
Telerik team
answered on 18 May 2011, 04:14 PM
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
Tags
General Discussions
Asked by
Peter
Top achievements
Rank 1
Answers by
Alexey Ivanov
Top achievements
Rank 1
Cody
Telerik team
Peter
Top achievements
Rank 1
Share this question
or