Ask a Question

Applying wait in BDD steps

SOLVED
TestQA1
Contributor

Applying wait in BDD steps

Hi All,

 

I have a bdd structure like below:

 

When (....)

some actions like click etc

Then (...)

Assertion script method....

aqUtils.Delay(1000);

 

When (....)

some actions like click etc

And (....)

some other action

Then (...)

Assertion script method....

aqUtils.Delay(1000);

 

Now the problem is that I have to apply Delay after most assertion methods in Then because the scenarios run after one another and the script fail if the second When in the second scenario runs quickly after the first Then in the first scenario.

 

Is this the correct way to apply delay or there is a better alternative to deal with this issue?

Thanks very much.

4 REPLIES 4
vinniew
Staff

Hi @TestQA1 

 

The only issue with the delay is that it is static. 

 

Where as other methods like wait property methods are dynamic. 

 

Here you just need to wait for a property value to be found before continuing

 

https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/common-for-all/waitpr...

Thank you.

But, what if the object does not exist (sometime it takes time for the object to exist) and you use object.WaitProperty('Exists',true). The error will be shown on the line 'object.WaitProperty' saying the waitproperty uses object that does not exists?

I saw this issue in one of my implementation. My knowledge may be very limited. 🙂

Hi @TestQA1 

 

If the object can't be found it may be linked to the criteria in the name mapping or the values you have defined in the wait property. 

 

The idea of the wait property is to wait until that property value equals the specified value or until a specified time limit elapses rather than a static wait time every time. 

 

Typically this is linked to the Auto-wait time out which can be extended. 

 

Alternatively you can add an explicit time limit just for that wait operation 

 

For example

 

Aliases.browser.pageSignUpLoginForm.buttonLogIn.WaitProperty("enabled", "true", 20);

 

Delays are just a short term way of figuring out whether you need to add in wait times or not.

 

KR


Vinnie 

Thanks Vinnie. Don't know why I kept associating the object initial declaration with waitproperty. I now understand the concept. Thanks again!

cancel
Showing results for 
Search instead for 
Did you mean: