Page 1 of 1

How to switch to next test case during execution?

Posted: Fri Apr 08, 2016 1:28 pm
by Ivan Irbis
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!

Re: How to switch to next recording module?

Posted: Fri Apr 08, 2016 2:00 pm
by odklizec
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

Re: How to switch to next test case?

Posted: Fri Apr 08, 2016 2:09 pm
by Ivan Irbis
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)

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

Posted: Tue Apr 12, 2016 9:02 am
by Martin
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.