Loop through button clicks - Flex calendar dropdown

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
CharlesCuozzo
Posts: 5
Joined: Tue Nov 27, 2012 4:13 pm

Loop through button clicks - Flex calendar dropdown

Post by CharlesCuozzo » Sat Dec 01, 2012 6:03 pm

I am evaluating Ranorex to determine if we can automate the creation of some reports from a Flex application. So, far we have had some success. I have some questions regarding one of the controls we have to click on, however.

There is a calendar dropdown control where, once we have caused it to dropdown with the Ranorex recording mechanism, we then have to click an arrow button to navigate through a number of months. We are able to do that by recording each click. So far, so good.

However, we want to be able to include some type of configuration file that can tell us how many months to navigate through (how many clicks to make on that arrow button). So, I have two questions.

1) Is there a way to loop and click the same control a preset number of times? Right now the code created by recording this activity has five separate clicks on that arrow button to get us to where we want to be. I would like to have some variable that, once set, determines how many times that button is clicked within a loop.

2) Is there a way to get the Ranorex program that is created from our recording to read in a specialized configuration file which would hold, for example, that preset number of clicks to execute on the button in question.

Thanks.

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

Re: Loop through button clicks - Flex calendar dropdown

Post by Support Team » Mon Dec 03, 2012 11:55 am

Hi,

In your case I would use the Data Driven approach of Ranorex.
You could create for instance a simple data table where you can add a loop variable
which you can use to specify how often your test case should be executed.
I would suggest reading the UserGuide section about data driven testing, here is the link: Data-Driven Testing.
You could for instance use a global parameter which can be set via a command line argument in order to specify the number of clicks.
Here is a link to the section about starting a test suite: Running Tests without Ranorex Studio.
I hope this will help you!

Regards,
Markus
.
Image

CharlesCuozzo
Posts: 5
Joined: Tue Nov 27, 2012 4:13 pm

Re: Loop through button clicks - Flex calendar dropdown

Post by CharlesCuozzo » Fri Dec 07, 2012 8:08 pm

Thanks for the quick response, and some of your answer is helpful. However, I need to add some additional detail.

I don't want to run the entire test multiple times in a loop - I just want to run a portion of the test within a loop. For instance, the part of the entire test that clicks the calendar button to navigate a given amount of months. For example, the calendar begins at January 2, 2012, and part of the test is to press a navigation button within the calendar that increments the visible month. I have to do this four times to get to May, so there are four of these button clicks in the test. What I want to do is be able to control how many times that button is pressed using either a configuration file, or, if that is not doable, then use the data driven technique you suggested.

So, I need to know how to get just the part of the recording that presses the button and just put that portion within a loop whose count is determined by some external setting (configuration file or data driven).

Is there a section within the code that I can do this? I see that the recording code is auto-generated, so anything I change in there would be overwritten if I had to modify the recording.

Thanks again for any help you can provide.

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Loop through button clicks - Flex calendar dropdown

Post by Ciege » Fri Dec 07, 2012 9:05 pm

My suggestion is to use user code and write that loop yourself...

Check the current month that is displayed and do 1 of the following:
1) click the next button, recheck month, click again, etc...
2) do some math to determine which month you need to get to and calculate the number of next clicks that need to be done

Quite simple actually...
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

CharlesCuozzo
Posts: 5
Joined: Tue Nov 27, 2012 4:13 pm

Re: Loop through button clicks - Flex calendar dropdown

Post by CharlesCuozzo » Fri Dec 07, 2012 9:36 pm

That sounds reasonable, but I am somewhat new to Ranorex. Where exactly would this code go?

Let's assume I have recorded some activities using the Recorder. Now there is some auto generated C# code that I probably shouldn't modify because the designer will overwrite any changes. Within that code is the button press I want to repeat. Where do I put the C# code to implement the loop and press the button several times.

Sorry, if this seems like a trivial question, but this is my first exposure to Ranorex. All I need are some indication of where the extensibility points are...the places where I can add custom code.

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Loop through button clicks - Flex calendar dropdown

Post by Ciege » Fri Dec 07, 2012 9:52 pm

If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...