Iterations as a variable

Ranorex Studio, Spy, Recorder, and Driver.
[email protected]
Posts: 7
Joined: Tue Mar 27, 2018 10:29 am

Iterations as a variable

Post by [email protected] » Fri Jul 06, 2018 7:56 am

I have a testsuite in Ranorex +20 test cases. The cases needs on most occasions to run several times, standard is 3. Do do this I have set the 'Iteration' property on each test case to 3. If a want to run the suite but with only 1 iteration I need to edit the 'iteration' property for all of the test cases in the suite. Is there any way to set the 'iteration' property as a variable so I only need to edit this in one place?

User avatar
Posts: 135
Joined: Mon Jul 11, 2016 4:01 pm

Re: Iterations as a variable

Post by N612 » Mon Jul 09, 2018 6:22 pm

If you don't need each test case to run its own iteration sequentially, you can nest all your test cases in a single smart folder. The only potential issue with this is that it will run TC1 > TC2 > TC3 > TC1 > TC2 > TC3... instead of TC1 > TC1> TC1> TC2> TC2 > TC2... which may not work for your test.
pic1.png (14.07 KiB) Viewed 2027 times
If this is an issue, you can easily change the iteration count across your test suite by multi-selecting each test case:
pic2.png (14.15 KiB) Viewed 2027 times
Hope this helps!

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

Re: Iterations as a variable

Post by odklizec » Tue Jul 10, 2018 9:20 am


Unfortunately, it seems to be impossible to set the IterationCount from code. Hence there is no way to set IterationCount from variable. However, it's possible to create a dynamic data connector from code, which can basically simulate the IterationCount! I'm using this approach in some of my tests ;) Take a look at this post: ... tml#p49222
Basically, you have to create a new code module, placed before the test case/smart folder in question. Then you can create a dynamically loaded data connector, with variable number of rows. 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