How to run the next module when a module fails?

Ask general questions here.
Fergal
Certified Professional
Certified Professional
Posts: 298
Joined: Tue Feb 18, 2014 2:14 pm
Location: Co Louth, Ireland
Contact:

How to run the next module when a module fails?

Post by Fergal » Wed Jul 15, 2015 3:05 pm

With a structure as follows:

- Test Case One
- - Recording Module 1
- - Recording Module 2

How can the test be set up, to run "Recording Module 2", in the event that "Recording Module 1" fails?

If all the action steps in "Recording Module 1" are set to "Enable Continue on Fail", "Recording Module 2" will run after "Recording Module 1" fails, but I don't want those action steps to be "Enable Continue on Fail".

Thanks!

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

Re: How to run the next module when a module fails?

Post by odklizec » Wed Jul 15, 2015 3:19 pm

Hi,

I think the only way to achieve what you want is to add each recording to a separate Test Case and then you will have to set Error behavior of the one holding "Recording Module 1" as Continue with Sibling.

So the test structure should look like this:
- Test Case One
- - SubTestCase 1 <------set error behavior as Continue with Sibling
- - - - Recording Module 1
- - SubTestCase 2
- - - - Recording Module 2

For more details check this user guide paragraph:
http://www.ranorex.com/support/user-gui ... html#c3028
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

Fergal
Certified Professional
Certified Professional
Posts: 298
Joined: Tue Feb 18, 2014 2:14 pm
Location: Co Louth, Ireland
Contact:

Re: How to run the next module when a module fails?

Post by Fergal » Wed Jul 15, 2015 3:25 pm

Thank you odklizec. Yes, I can do it the way you suggest. However, I want to keep the modules in the same TC, if possible.

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

Re: How to run the next module when a module fails?

Post by odklizec » Thu Jul 16, 2015 7:43 am

I'm afraid, you will either have to use "Enable Continue on Fail" in Recording1 or you will have to use suggested sub-test cases. I think the second one is the easiest and cleanest solution of your problem.

Yet another possibility could be adding some custom code to the Teardown section of Test Case One, where you evaluate the success/failure status of Recording1 and if failed, start the Recording2 from code like this: Recording2.Start();
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

Fergal
Certified Professional
Certified Professional
Posts: 298
Joined: Tue Feb 18, 2014 2:14 pm
Location: Co Louth, Ireland
Contact:

Re: How to run the next module when a module fails?

Post by Fergal » Thu Jul 16, 2015 9:41 am

Thanks very much for your help odklizec, I appreciate it and will use one of those three options when required.

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

Re: How to run the next module when a module fails?

Post by yaro2o » Wed Feb 14, 2018 3:07 pm

Hi i heave another question how run next TestCase using the code ?

suppose I have a situation that I get a mistake at the beginning of the test casa and I want to start the next one but I have to reset all previously made actions, popupwatcher looks after the error window but I would like to add shares to the next test case

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

Re: How to run the next module when a module fails?

Post by odklizec » Wed Feb 14, 2018 3:32 pm

Hi,

As far as I know, there is currently no way to start a TC from code. And there is definitely no way to use popupwatcher to control the test suite flow. The problem with popup watcher is, that it runs in a separate thread and there is currently no way to pause/stop the main test thread from it. So if you hoped to use popup watcher to control the test flow, you should forget about it ;)

The best you can probably do is to create a condition in each test case (following the first one), which would check a presence of string in given global parameter. The global parameter should be then filled from first (any) test case preceding the one with condition. And if the condition in subsequent TC does not find or match the expected string, the TC should start (or not). Hope this helps?
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