Forum Discussion
ringraham wrote:I would like to have my script continue running until a given event has occurred.
Hello ringraham,
You could use Runner.Stop(true), that will stop the current test running.
Let me know if that helps.
Regards,
Leandro de Araújo Souza
- ringraham10 years agoContributor
Hi Leandro,
Thanks very much for that idea. I didn't know about the Runner.Stop. However, my problem isn't stopping the script, my problem is allowing a script to keep running. I have a main script that performs a number of tests while running a certain file that is being "played back". However, there are a number of screen image compares I want to do once the file has completed playing. I have a timer going off every 10 seconds that checks to see when the "Rewind" button has been re-enabled, thus indicating the file is done playing. This is setup from the main test script. Unfortunately, the main test script stops everything once it reaches the bottom of the script. I'm looking for a way to continue the test until the "rewind" button is re-enabled, screen compare tests are done, and then I can call the Runner.Stop command.
Hope this makes more sense. Thanks again.
-Ron
- joseph_michaud10 years agoModerator
I suspect that the Runner.CallObjectMethodAsync() method is going to be part of your solution. Start here: Calling Methods Asynchronously
- ringraham10 years agoContributor
The async callback idea was a great help, but the better solution was the next one suggested which uses a while loop. The example for async calls in the SmartBear docs also used a while loop to wait for a response. Thus I marked the "while loop" answer as the one I will use, though it is really a combination of both. Thanks!
- leandroaraujoso10 years agoContributor
I think I got this time. Please, try this:
while ( ! myRewindButton.Enabled || TimeOutNotReached )
{
}
Let me know if that helps.
Regards,
Leandro de Araújo Souza
- ringraham10 years agoContributor
Thanks Leandro. This turned out to be the best solution. I actually combined it with the async callback, though as in your example, it could easily be implemented with simple flags. I think I was looking for something more complex and yet, the simple while loop was all I really needed.
Related Content
- 3 months ago
- 12 years ago
- 3 years ago
- 4 years ago
Recent Discussions
- 7 hours ago