Where do you change the default 2.5m Validation duration

Mobile Testing, Android App Testing.
gilbar16
Posts: 109
Joined: Wed Mar 26, 2014 6:23 pm

Where do you change the default 2.5m Validation duration

Post by gilbar16 » Fri Mar 18, 2016 9:37 pm

When you Validate for a non-existence of an object, the default duration is 2.5m which is kind of too long. After 2.5 minutes, Ranorex will pass the test when the object is not found.

Where do you change this duration or how do you override this value? The Properties tab does not have it.

Thanks.
Gilbert

lucian.teodorescu
Posts: 82
Joined: Fri Oct 24, 2014 10:58 am
Location: Bucharest

Re: Where do you change the default 2.5m Validation duration

Post by lucian.teodorescu » Mon Mar 21, 2016 8:44 am

Hi Gilbert,


Validate.Exists(itemToFind) takes longer because it is looking for that item using default search time (which is 30s for the first level and adds 30s for each deeper level in the repository structure, when using Rooted Folder instead of Simple Folder). In repository right-click your item > Properties and check 'Effective timeout' to see how long you are looking for it.

Or in your module, right-click Validate.Exists() action > Set search timeout.
You can override that effective timeout in user code, using something like this:
Validate.Exist(itemToFind, duration)

Another easy way to override Validate.notExists() without user code is WaitForNotExists() with a short timeout.
I find this approach more convenient. For example, when I click on a button and expect it to disappear.
Also if you click on something and want to make sure one item does not pop-up (i.e. does not exists within 15s), you can use this code:

Code: Select all

 if (itemInfo.Exists(15000)) {
				Validate.Fail("This item should not exist.");
			}
			else
			{
				Report.Success("OK", "The item was not found within 15s.");
			}
You do not have the required permissions to view the files attached to this post.
Lucian Teodorescu
NetSun Software

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

Re: Where do you change the default 2.5m Validation duration

Post by odklizec » Mon Mar 21, 2016 8:59 am

Hi Gilbert,

This 2.5m timeout is called Effective Timeout and it's a sum of Search Timeouts of a given element and all its ancestors. In my opinion, it's neither a good idea to change this value nor it's possible easily change it by calling a simple method for given repo element. Please check my previous post here:
http://www.ranorex.com/forum/why-there- ... tml#p36008

The easiest way to avoid waiting entire Effective Timeout (during Validate.NotExists) is using Validate.NotExists with timeout parameter. However, from some unknown reasons, there is currently no way to use timeout parameter directly with repo element ;) It's only possible to define Validate.Exists/NotExists with timeout using a rxpath. Luckily, there is a simple workaround ;)

You can call the Validate.NotExists like this:

Code: Select all

Validate.NotExists(repo.path.to.ElementInfo.AbsolutePath, 5000); //validates not existence or repo element for 5secs
Hope this helps?
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