Page 1 of 1

Skip module during runtime?

Posted: Wed Apr 26, 2017 12:55 pm
by npanag
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?

Re: Skip module during runtime?

Posted: Wed Apr 26, 2017 1:28 pm
by odklizec
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

Re: Skip module during runtime?

Posted: Wed Apr 26, 2017 2:01 pm
by npanag
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

Re: Skip module during runtime?

Posted: Wed Apr 26, 2017 2:15 pm
by odklizec
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.

Re: Skip module during runtime?

Posted: Fri May 12, 2017 1:32 pm
by npanag
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

Re: Skip module during runtime?

Posted: Tue May 16, 2017 9:46 am
by npanag
Any answer about the GetTestCase() in Ranorex 7.0?

Thank you

Re: Skip module during runtime?

Posted: Tue May 16, 2017 9:54 am
by odklizec
Hi,

Just replace GetTestCase with GetTestContainer method. Hope this helps? ;)

Re: Skip module during runtime?

Posted: Tue May 16, 2017 10:35 am
by npanag
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?

Re: Skip module during runtime?

Posted: Tue May 16, 2017 11:07 am
by odklizec
Yep, nothing changed in this matter in 7.x

Re: Skip module during runtime?

Posted: Tue May 16, 2017 12:19 pm
by npanag
Thanks a lot odklizec.

Your help is always invaluable.