Page 1 of 1

how to repeat certain steps in a record file

Posted: Mon Aug 17, 2009 10:47 pm
by lingzhou
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?

Re: how to repeat certain steps in a record file

Posted: Tue Aug 18, 2009 1:11 pm
by Support Team
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

Re: how to repeat certain steps in a record file

Posted: Fri Aug 07, 2015 6:21 am
by eric.franc
Hello,

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

Thanks,

Re: how to repeat certain steps in a record file

Posted: Fri Aug 07, 2015 2:44 pm
by krstcs
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.

Re: how to repeat certain steps in a record file

Posted: Mon Aug 10, 2015 6:40 am
by eric.franc
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.

Re: how to repeat certain steps in a record file

Posted: Mon Aug 10, 2015 4:32 pm
by krstcs
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?

Re: how to repeat certain steps in a record file

Posted: Mon Aug 10, 2015 7:22 pm
by eric.franc
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

Re: how to repeat certain steps in a record file

Posted: Mon Aug 10, 2015 7:56 pm
by krstcs
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.

Re: how to repeat certain steps in a record file

Posted: Mon Aug 10, 2015 8:05 pm
by Support Team
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