cancel
Showing results for 
Search instead for 
Did you mean: 

Does anyone have good examples of the user of Wait in keyword testing

SOLVED
jthompson1
Contributor

Does anyone have good examples of the user of Wait in keyword testing

I keep trying to implement the Wait property instead of using delay as our websites response times are all over the place and my tests keep failing because an object was not available yet. I was attempting to use documentation and I have so far been failing at the implementation of this method. It seems it doesn't apply to all types and I was wondering if there is just a really easy example and explanation that someone with experience could drop here. I am not doing scripting of any kind but rather the operations you drag and drop into keyword tests. I often times try to apply Wait to an object and it just stalls in the playback and doesn't execute at all. I feel like mastering this is of great importance as I can't keep having my tests fail based on timing issues. Anyways any response or help would be great thanks. 

1 ACCEPTED SOLUTION

Accepted Solutions
AlexKaras
Community Hero

Re: Does anyone have good examples of the user of Wait in keyword testing

Hi,

 

Generally speaking, with most of modern web applications, one must wait three times:

-- First, test code must wait until the requested page is obtained from the server. This is what .Wait() method in TestComplete is for;

-- Then, test code must wait until the received web page markup is processed by the browser, until browser downloads all required additional libraries specified in page script code, until browser executes initial script code and renders the page. In a nutshell - on this second wait test code must wait until the target control appears on the screen. (Note, code must first wait for control itself and only then can wait for some property value of this control -- there is no reason to wait for the property of control that does not exist) This is what .WaitXXX() methods in TestComplete are for;

-- Then, in some cases, test code must additionally wait until the target control is populated with data and becomes ready to interact with end-user.

 

Two last waits does not have any special support in TestComplete and must be implemented in test code as the actual implementation of these waits depends on the tested web page.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

View solution in original post

4 REPLIES 4
Marsha_R
Community Hero

Re: Does anyone have good examples of the user of Wait in keyword testing

If the documentation is not helping you, then give us a screenshot of your code that is failing.  Tell us what you expected to happen and what actually happened and we can help you from there.

vinniew
Staff

Re: Does anyone have good examples of the user of Wait in keyword testing

I personally prefer using on-screen actions, specify an object id like to wait for and apply a wait child or wait property method. 

 

https://support.smartbear.com/testcomplete/docs/keyword-testing/reference/test-actions/on-screen-act...

 

You could also increase the wait period either in the execution plan or on a project level see https://support.smartbear.com/testcomplete/docs/app-objects/common-tasks/waiting-process-or-window-a... 

jthompson1
Contributor

Re: Does anyone have good examples of the user of Wait in keyword testing

Using On Screen Action, method WaitProperty. 

jthompson1_0-1616702128095.png

Parameters entered for method.

jthompson1_1-1616702295412.png

First Name Input field I am targeting. I am trying to wait for it to load. I thought i was targeting the property by name and the value of the property but perhaps I am missing something. It causes test to fail because object cannot be found.

 

 

AlexKaras
Community Hero

Re: Does anyone have good examples of the user of Wait in keyword testing

Hi,

 

Generally speaking, with most of modern web applications, one must wait three times:

-- First, test code must wait until the requested page is obtained from the server. This is what .Wait() method in TestComplete is for;

-- Then, test code must wait until the received web page markup is processed by the browser, until browser downloads all required additional libraries specified in page script code, until browser executes initial script code and renders the page. In a nutshell - on this second wait test code must wait until the target control appears on the screen. (Note, code must first wait for control itself and only then can wait for some property value of this control -- there is no reason to wait for the property of control that does not exist) This is what .WaitXXX() methods in TestComplete are for;

-- Then, in some cases, test code must additionally wait until the target control is populated with data and becomes ready to interact with end-user.

 

Two last waits does not have any special support in TestComplete and must be implemented in test code as the actual implementation of these waits depends on the tested web page.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors