Knowledge Base Article

Home Page > Knowledge Base > Rapise

Home Page > Knowledge Base > Rapise > Rapise Desktop

Home Page > Knowledge Base > Rapise > Rapise Mobile

Home Page > Knowledge Base > Rapise > Rapise Web

Article Global.DoWaitFor vs Global.DoWaitForProperty

by Adam S on Wednesday, January 6, 2016

The most commonly used synchronization option to make Rapise wait until the application under test (AUT) is ready is the Global.DoSleep(milliseconds)function. However having just a sleep may cause an unnecessary delay because we have to consider the maximum wait interval and it may be much less on average. Rapise includes some additional synchronization options for more fine grained control of the test case flow.

In this article we show the difference between the Global.DoWaitFor and Global.DoWaitForProperty synchronization functions.

Let’s consider an example. We have an application that is doing some initialization during load:

Finally, when initialization is done, the “Proceed>” button appears on the screen:

Global.DoWaitFor is used when there is an object that may not exist on the screen before some point of time. In the AUT (application under test) we have a button "Proceed>>" that is not available until the app finishes loading. So here is how we can wait for the object:

if(Global.DoWaitFor('Proceed__', 15000))


     // We are here because DoWaitFor succeeded!



1st parameter represents an object by its Object ID, just like it is used by the SeS() function). 2nd is a timeout to wait for. If object is not found then DoWaitFor just returns false without writing anything to the report.

Global.DoWaitForProperty is used when there is an object that changes its state during the process and we need to wait for it to reach specific state. It may be progress bar or status message. In the considered application we have a Title (WindowText) that is visible all the time and finally it says "Ready" when the application is loaded:

So we wait for a specific value of the title, exactly what we do via Global.DoWaitForProperty:

if(Global.DoWaitForProperty('LoadingForm', 'GetWindowText', 'Ready', 15000))


      // We are here because DoWaitForProperty succeeded:

      // title is now 'Ready'



Please, note that the first parameter is an Object ID, similar to that used by DoWaitFor. The second parameter is getter function name or action name (i.e. GetWindowText, DoGetText or whatever is available for the given type of object). The third parameter is the expected value that we are waiting for. The last parameter is the timeout (in milliseconds).

If the object is not present or didn’t reach required the state, the function simply returns false after the specified timeout without writing anything into the report.

The attached sample test contains an AUT and a test case implementing both synchronization functions.
Article Info
Last Updated: 1/6/2016
Article ID: KB186
# Views: 790
Powered by KronoDesk v1.1.0.15 | © Copyright Inflectra Corporation 2011-2017 | Licensed to Inflectra Corporation.