Starting next iteration of test

Ask general questions here.
manish
Posts: 23
Joined: Fri Aug 10, 2018 12:46 pm

Starting next iteration of test

Post by manish » Tue Feb 19, 2019 2:54 pm

Hi All,

I am running a data driven test where I have around 100 data points in the data set.
I want the testcase to wait for a certain event to occur and then decide how to proceed with testcase execution.

If(condition happens){
Stop the current iteration with a warning message and start with the next iteration.
}

How do I start the next iteration from code without throwing an error/failure and continue with next iteration?

Thank you
Manish

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

Re: Starting next iteration of test

Post by odklizec » Tue Feb 19, 2019 3:21 pm

Hi,

I think the only non-error way to do what you want is using SmartFolder(s) with condition and a code module (placed before SmartFolder with condition), which should check the test state and fill a TestCase parameter. This TC parameter would be then evaluated in SmartFolder condition.
Here is a mockup of test case structure:

Code: Select all

[TestCase] <- data connector and TC parameter e.g. 'tcState'
|_RecModule
|_RecModule
|_...
|_CodeModule <- here you should evaluate the TC state and fill 'tcState' (e.g. tcState="0" for stop, tcState="1" for continue)
|_[SmartFolder] <- condition evaluating tcState (do not run SF if tcState=="0") 
    |_RecModule
    |_RecModule
    |_RecModule
    |_...
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

manish
Posts: 23
Joined: Fri Aug 10, 2018 12:46 pm

Re: Starting next iteration of test

Post by manish » Wed Feb 20, 2019 9:19 am

Hi,

Thanks for the reply. This is not what I want to do. It is during the execution, that I wait for a certian element to occur (this is the wait condition) and then either continue with the test case or start with a new iteration.
I am able to do this by throwing an error and starting the next iteration but I am looking for a way in which I do not have to introduce errors.

Regards,
Manish

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

Re: Starting next iteration of test

Post by odklizec » Wed Feb 20, 2019 9:34 am

Hi,

The solution I suggested does exactly what you have described. The only problem is, that it will work only if you know EXACT place, where you want to validate an element. And from the description of your problem I understood that you know the decision point? So instead of Validate, you can use Exists() method. If element exists, you can continue with TC, otherwise, it will not run the TC. True, the solution I described will require you to modify your test workflow.

If you are looking for a 'global' solution, running above the test itself (in a separate thread), and which will check every action/element used in every recording, then I'm afraid, you are probably out of luck?
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

manish
Posts: 23
Joined: Fri Aug 10, 2018 12:46 pm

Re: Starting next iteration of test

Post by manish » Thu Feb 21, 2019 8:55 am

It woks if I use :
return;

inside the condition. It sopts the current iteration and moves on to the next one.

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

Re: Starting next iteration of test

Post by odklizec » Thu Feb 21, 2019 9:00 am

Hi,

You mean you simply added a condition (with return) in one of your TC recordings and it skipped next recording steps and all remaining recordings in actually running iteration (without throwing an exception) and then it started new iteration?
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

manish
Posts: 23
Joined: Fri Aug 10, 2018 12:46 pm

Re: Starting next iteration of test

Post by manish » Thu Feb 21, 2019 9:30 am

Hi,


I do not use recording modules for my tests. I have a bunch of code modules that I use as individual testcases. I mean 1 module corresponds to 1 testcase. In this particular case, I use the return statement to loop out of the Run() method for that particular module iteratoion and start with the next one.

My soltion looks something like this
[Test Suite] (global variables)
[Smart Folder A]
[Testcase 1] (data driven)
[User code module 1] -------> Use return; Loops out of iterationa nd continues with next iteration
[Testcase 2] (data driven)
[User code module 2] -------- Testcase executes nevertheless
...
...


Regards,
Manish

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

Re: Starting next iteration of test

Post by odklizec » Thu Feb 21, 2019 9:45 am

I see. In such particular case yes, Return is a solution. But If there would be two or more modules in one test case, it would not work, because instead of running next iteration, it would go to module2,3, etc...
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