Stop current TC and run next

Best practices, code snippets for common functionality, examples, and guidelines.
yaro2o
Posts: 51
Joined: Mon Jan 29, 2018 11:19 am

Stop current TC and run next

Post by yaro2o » Fri Jul 13, 2018 9:38 am

Hi i wite code in popupwatcher module, and I need something like that

Code: Select all

if(popup.exist)
{
stop current TC 
Run next TC
}

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Stop current TC and run next

Post by odklizec » Fri Jul 13, 2018 11:25 am

Hi,

I'm not quite sure if there is a way to achieve what you want? At first, popupwatcher is running in a second thread and does not allow to stop or modify things in the main test thread. It was discussed many times in the past. However, thanks to Ranorex Test Automation Helpers, it's now possible to pause the execution of test (from popupwatcher thread) and do some things, while the test is paused! This can be achieved with new popupwatcher method called PauseWhileExists (available in Test Automation Helpers). Once called, Ranorex tries to pause the test at nearest possible action. In other words, it may not pause right after the popup window appearance! It may take just one or more test steps, before the test is paused ;)

I'm still not sure if it's possible to "fail" the actually paused test and start the next one? I would suggest to set the error behavior of each testcase to "Continue with Sibling/Parent" (depending of your test suite structure). Then pause the test from popup watcher and try to fail it by throwing a new Ranorex exception. In a theory, after closing the popup element (which paused the test) the test should resume, terminate the existing (pause) test case and continuing with next one? But it's just a theory :D

I'm pretty sure that there is no (official) programming way to start the particular test case from code. But even if there would be such option, I would not recommend it at all ;) Calling test cases or individual modules from code would create a mess.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

yaro2o
Posts: 51
Joined: Mon Jan 29, 2018 11:19 am

Re: Stop current TC and run next

Post by yaro2o » Fri Jul 13, 2018 11:59 am

Thanks for the answer, I dont want to call a specific TC just after that in which the popup found a window.

Sample

TC01
-Module 1 /here popup watcher finds a window that does not let continue TC01 close it, closes the program and starts it again
-Module 2 /but still w8 for this module and after they dont find it run TC02
TC02
-Module 1
-Module 2

All works fine but im must w8 to module2, waste of time