Using if statements for dialogs

Mobile Testing, Android App Testing.
MClelland92
Posts: 2
Joined: Thu Oct 02, 2014 4:47 pm

Using if statements for dialogs

Post by MClelland92 » Thu Oct 02, 2014 5:08 pm

Hi, I'm automating an Android app test using Ranorex 5.1.3 with Android version 4.4.3 with a USB connection method

I'm also trying to use an if statement so that if a dialog box that asks for a password appears, then start a certain recording module and if it doesn't appear then start another recording module.

List of steps Ranorex would go through (If this helps)
1. Open app
2. Select item in the list
3. Dialog asking for a password could appear

If dialog appears
4. Enter password and continue

If the dialog does not appear
4. Continue app usage

Thanks,
Marc

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Using if statements for dialogs

Post by Support Team » Mon Oct 06, 2014 12:20 pm

Hello Mclelland92,

Ranorex is not designed for conditional test execution. Therefore, logic can be implemented only within UserCode.

Another approach for handling (unexpected) dialogs would be a pop-up watcher, but it depends on your app if a pop-up watcher is convenient for your scenario.

Regards,
Robert

MClelland92
Posts: 2
Joined: Thu Oct 02, 2014 4:47 pm

Re: Using if statements for dialogs

Post by MClelland92 » Mon Oct 06, 2014 3:01 pm

Ok, thank you for replying. I currently am using User code within my test but I thought it was possible to move to different recording modules.
Just to confirm, it will be one user code module to look for the dialog then deal with it within the same code module?

Example:
If password dialog exists, then enter password.
Else continue using app.

Thanks,
Marc

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Using if statements for dialogs

Post by Support Team » Wed Oct 08, 2014 3:34 pm

Hello Marc,

If you use the pop-up watcher (which runs on a different thread) it will always keep looking for your specific dialog and handle it.

Another approach would be to call UserCodeModules or Recordings which handle the dialog within another Recording as explained here:
http://www.ranorex.com/forum/calling-re ... tml#p13465

Hope this information helps.

Regards,
Robert