Skip module during runtime?

Ask general questions here.
npanag
Posts: 33
Joined: Thu Jun 02, 2016 5:42 pm

Skip module during runtime?

Post by npanag » Wed Apr 26, 2017 12:55 pm

Hi,
I have a test case (with iteration from an Excel file with contacts), that contains two recording modules: One that checks if a contact exists and the second that creates a new contact in the case that it doesn't exist.

If the contact exists, I want just a warning (Report.Warn) and the code to bypass the second module of the test case.
In other words, if there is a contact already, I want the result green. For this reason I cannot use Validate fail in the first recording module because it makes red the final result.

I also used Report.Failure in the first module in the case of existence, but the code continues to the second module instead of skipping it.

I saw something with endmodule but I wasn't able to find a good example.

Any help?

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

Re: Skip module during runtime?

Post by odklizec » Wed Apr 26, 2017 1:28 pm

Hi,

I'm not quite sure if there is a way to disable a recording module in runtime, however, there is an easy way to achieve what you want. Simply enclose the optional module in nested TestCase and use code described below to skip or enable a test case:
how-to-continue-to-next-iteration-or-ju ... tml#p36500
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

npanag
Posts: 33
Joined: Thu Jun 02, 2016 5:42 pm

Re: Skip module during runtime?

Post by npanag » Wed Apr 26, 2017 2:01 pm

Yes, odklizec, it worked this way. Thank you.

Tot tell the truth, I would like the recording modules to be on the same level, but OK, this is secondary.

Thanks a lot

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

Re: Skip module during runtime?

Post by odklizec » Wed Apr 26, 2017 2:15 pm

Myabe there is a coded way to disable Recording/Code module at runtime, but honestly, I've never looked into it ;) Usually, in my tests, I need to disable number of modules at once and so the TC-based way was much more convenient to me. Nice to hear it worked for you too.
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

npanag
Posts: 33
Joined: Thu Jun 02, 2016 5:42 pm

Re: Skip module during runtime?

Post by npanag » Fri May 12, 2017 1:32 pm

Question about new Ranorex 7.0:

I heard that GetTestCase() method is discontinued. This means it is not possible anymore to create nested test cases in my test suite.
A test case cannot have a parent test case anymore. Either the parent, or the child test case must be a smart folder instead.

So, we replace the GetTestCase with something other?

Thank you

npanag
Posts: 33
Joined: Thu Jun 02, 2016 5:42 pm

Re: Skip module during runtime?

Post by npanag » Tue May 16, 2017 9:46 am

Any answer about the GetTestCase() in Ranorex 7.0?

Thank you

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

Re: Skip module during runtime?

Post by odklizec » Tue May 16, 2017 9:54 am

Hi,

Just replace GetTestCase with GetTestContainer method. 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

npanag
Posts: 33
Joined: Thu Jun 02, 2016 5:42 pm

Re: Skip module during runtime?

Post by npanag » Tue May 16, 2017 10:35 am

But the concept is again the same, isn't so?

Recording modules cannot be checked or unchecked so we need the GetTestContainer method in a parent container to be checked or unchecked in the code, correct?

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

Re: Skip module during runtime?

Post by odklizec » Tue May 16, 2017 11:07 am

Yep, nothing changed in this matter in 7.x
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

npanag
Posts: 33
Joined: Thu Jun 02, 2016 5:42 pm

Re: Skip module during runtime?

Post by npanag » Tue May 16, 2017 12:19 pm

Thanks a lot odklizec.

Your help is always invaluable.