Able to place an 'IF' clause during recording?

Mobile Testing, Android App Testing.
TonyB
Posts: 4
Joined: Mon May 11, 2015 6:48 am

Able to place an 'IF' clause during recording?

Post by TonyB » Wed May 13, 2015 11:36 pm

Hi again

We have an upcoming application for both Android and iOS. When a user has the free version and goes to the main screen a full page advert can be shown which can be closed by tapping a big X. The problem is that the ads are random and based on locations etc.

Is there anyway to do an 'IF' clause within the recorded project? So that 'IF' the advert shows, to exit the ad, and if not then to continue?

Probably an easy question, but still in evaluation stage.


Thanks

Tony

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

Re: Able to place an 'IF' clause during recording?

Post by odklizec » Thu May 14, 2015 7:08 am

Hi,

I'm afraid, there is no way to create conditional statements during recording the test. The only way to add "IF" statement to (existing) recording is to convert the affected actions to User Code and then add "IF-ELSE" statement to that user code. Simple select the rows in recording, right click the selection and from the appeared menu select "Merge Items to User Code Item". Then you can edit the User Code in UserCode.cs.
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

zivshapirawork
Posts: 65
Joined: Wed Sep 24, 2014 7:47 am
Location: Israel

Re: Able to place an 'IF' clause during recording?

Post by zivshapirawork » Thu May 14, 2015 11:13 am

As stated before , user code is one way.

another way to enter a step that clicks on the ad, but use the menu to make it an optional step. If it succeeds (ad appeared) the recording goes on.

if it didn't find the ad, then the step fails, but the recording goes on (since it is optional).

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

Re: Able to place an 'IF' clause during recording?

Post by krstcs » Thu May 14, 2015 4:56 pm

The problem with using [Continue on Failure] or [Optional] is that it still puts a failure in the test, even though it may not be a failure. Some of us only want to see failures in the report when validations fail.

The use of user-code is the best method as it allows you to describe exactly what situations you want to look for and handle without throwing exceptions (failures), and then validate accordingly.
Shortcuts usually aren't...