Repeat action item several times in data driven testing

Ask general questions here.
[email protected]
Posts: 15
Joined: Tue Jun 09, 2020 3:31 pm

Repeat action item several times in data driven testing

Post by [email protected] » Thu Jun 18, 2020 9:01 pm

Hi everyone. I have a mouse click (recording action). This mouse clicked is linked to a column of a data source. Is it possible to repeat this action a different number of times for each row of the data source while executing the data driven test. e.g

When running Row 1 - Click 3 times
When running Row 2 - Click 2 times
When running Row 2 - Click 5 times

Is this possible

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

Re: Repeat action item several times in data driven testing

Post by odklizec » Fri Jun 19, 2020 8:11 am

Hi,

Of course, anything's possible ;) There are two basic approaches.
Code-less way:Add the mouse click action to an individual recording/code module and insert this module to new SmartFolder. Then set the cycle count of given smartfolder to 3. Now add a condition that will run the smartfolder in case the parant data connector is at row 1. And finally, copy the smartfolder 2 times and update the count value and condition for rows 2 and 3.
Coded way:
In recording where the click is performed, convert the click to user code. Then in the user code, enclose the click in "If" condition and read the actual Row number of data connector of your choice. Then in the "If" condition, perform loop as many times as you need for each data connector row.
You can find some examples of reading data connector iteration number here:
https://www.ranorex.com/forum/viewtopic ... 27&p=50579
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

[email protected]
Posts: 15
Joined: Tue Jun 09, 2020 3:31 pm

Re: Repeat action item several times in data driven testing

Post by [email protected] » Tue Jun 30, 2020 10:51 am

Great!!. Thank you