How to switch to next test case during execution?

Best practices, code snippets for common functionality, examples, and guidelines.
Ivan Irbis
Posts: 2
Joined: Wed Apr 29, 2015 2:30 pm

How to switch to next test case during execution?

Post by Ivan Irbis » Fri Apr 08, 2016 1:28 pm

Hello,

could somebody advice how (during project execution) to stop execution of current test case and continue execution with next test case in same test suite.


Thank you!
Last edited by Ivan Irbis on Fri Apr 08, 2016 2:59 pm, edited 3 times in total.

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

Re: How to switch to next recording module?

Post by odklizec » Fri Apr 08, 2016 2:00 pm

Hi,

I'm not quite sure what exactly you want to achieve. Could you please add some more details?

I can only assume, that because of some detected (unexpected) state in the middle of recording module, you want to skip the rest of recording and continue with another module?
My suggestion would be to fail the test case (using an exception thrown in recording module) and Continue with Sibling error behavior, as described here:
http://www.ranorex.com/support/user-gui ... html#c3028

Basically, the structure of your solution should look like this:
TestCase1 (Error Behavior: Continue with sibling):
---Module1 <--- make this module to fail => this will skip the rest of steps and jump to Module2
TestCase2
---Module2
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

Ivan Irbis
Posts: 2
Joined: Wed Apr 29, 2015 2:30 pm

Re: How to switch to next test case?

Post by Ivan Irbis » Fri Apr 08, 2016 2:09 pm

Yes, of course, I will clarify the question:

in the code I want to do:

if (some case)
{
stop execution of current test case, and start execute next test case in current test suite
}

like after I started project execution, if some (my own) validation in some test case didn't passed, the project continue to run from next test case in test suite

..and all this without any errors in report (only warning may be)

Martin
Posts: 152
Joined: Fri Aug 15, 2014 12:24 pm

Re: How to switch to next test case during execution?

Post by Martin » Tue Apr 12, 2016 9:02 am

Maybe try to group your user actions and methods into an if-statement.

Code: Select all

if (case1 == true)
{
    Method1();
} else {
    Method1();
    Method2();
    Method3();
}
So if case is matched it will run the required methods only and the other methods will not be reached during the execution.