how to repeat certain steps in a record file

Ask general questions here.
lingzhou
Posts: 21
Joined: Fri Jul 10, 2009 7:49 pm

how to repeat certain steps in a record file

Post by lingzhou » Mon Aug 17, 2009 10:47 pm

say i have 10 steps in a record file and I would like to repeat step 3-7 only for a certain amount of times. Is there any easy way of doing that?

Also, is there any easy way to using different input parameter during the repeat?

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: how to repeat certain steps in a record file

Post by Support Team » Tue Aug 18, 2009 1:11 pm

Hi lingzhou!
Repeating is only possible via Loops(.net language) in code files but not directly in Recorder View.

If you want to use different input parameters you should look into our User Guide: Data-Driven-Testing tutorial( http://www.ranorex.com/support/user-gui ... sting.html ) which give you a good explanation how to add parameterized input functionality.

Regards,
Christian
Ranorex Support Team
.
Image

eric.franc
Posts: 20
Joined: Tue May 05, 2015 11:25 am

Re: how to repeat certain steps in a record file

Post by eric.franc » Fri Aug 07, 2015 6:21 am

Hello,

Do you have a snipet how to loop steps programatically ?
I could not find it in the API documentation.

Thanks,

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: how to repeat certain steps in a record file

Post by krstcs » Fri Aug 07, 2015 2:44 pm

Eric,

You have two choices:

1. Move the steps to user-code, as Christian suggested, and loop over them in .NET code.

or

2. Move the steps that need to be looped into their own module and put them in a child test-case with data that will make them loop the way you want. (Test cases are essentially for-each loops that loop over each row of data in the connected data set.)


There is no automatic way to do this.
Shortcuts usually aren't...

eric.franc
Posts: 20
Joined: Tue May 05, 2015 11:25 am

Re: how to repeat certain steps in a record file

Post by eric.franc » Mon Aug 10, 2015 6:40 am

krstcs wrote:Eric,

You have two choices:

1. Move the steps to user-code, as Christian suggested, and loop over them in .NET code.

or

2. Move the steps that need to be looped into their own module and put them in a child test-case with data that will make them loop the way you want. (Test cases are essentially for-each loops that loop over each row of data in the connected data set.)


There is no automatic way to do this.
How do you move the steps from the user code ? I cna't find how to do it in the API.
Could you add an example.

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: how to repeat certain steps in a record file

Post by krstcs » Mon Aug 10, 2015 4:32 pm

Please explain what you are trying to accomplish.

Also, I'm not sure what you mean by "move the steps from the user code", can you explain why you are moving things FROM user code?
Shortcuts usually aren't...

eric.franc
Posts: 20
Joined: Tue May 05, 2015 11:25 am

Re: how to repeat certain steps in a record file

Post by eric.franc » Mon Aug 10, 2015 7:22 pm

Hello,

I just want to programatically repeat certain steps.
I have a record with 10 steps and I want to repeat step 3 and 4 several times.

I reply to this topic because it was mention that it was programatically possible to repeat certain steps using .Net programming.

regards,
/Eric

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: how to repeat certain steps in a record file

Post by krstcs » Mon Aug 10, 2015 7:56 pm

OK, in user-code you have to use a .NET loop of some kind. What kind of loop depends on what you want to do.

But, you still haven't fully explained what you are trying to accomplish. You say you want to loop over steps 3 and 4, but you don't say how you want to loop, or what the loop is supposed to do. We need to know what the objective of the loop is, not just that you want to loop.

So, again, please explain EXACTLY what you are trying to accomplish, not just what you want the test to look like. What task in the system-under-test makes it necessary to loop over these steps?



My guess is that you really don't want to loop in user-code, because you are, more-than-likely, trying to loop over some part of your data set, which means you need to move the actions (steps 3 and 4, and steps 5-10) into their own modules and then move them into test cases as necessary to make the loop work correctly.

EDIT: Fixed step numbers.
Last edited by krstcs on Mon Aug 10, 2015 8:21 pm, edited 1 time in total.
Shortcuts usually aren't...

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: how to repeat certain steps in a record file

Post by Support Team » Mon Aug 10, 2015 8:05 pm

Hello Eric,
I believe you meant to user code. You can simply multiselect the actions you want to loop on in your action table/Recording module, then right click and select Merge items to user code item:

Image

Now you can edit the user code method just created, to add whichever looping method is appropriate for your needs.

Regards,
Bassem
.
Image