The online community for software testing & quality assurance professionals
 
 
Calendar   Today's Topics
Sponsors:
Lost Password?

Home
BetaSoft
Blogs
Jobs
Training
News
Links
Downloads



Testing Tools >> HP Functional Testing / Mercury QuickTest Pro / QTP

Pages: 1
KMR_rajkumar
Member


Reged: 07/06/08
Posts: 39
WaitProperty Vs Sync
      #555273 - 03/09/09 02:14 AM

I am automating the my application using QTP. Each time if I edit or navigate to next page in my application the page is getting refreshing.

Currently I am using Sync function in QTP to wait for the page to refresh and I have given more synchronous time out in the test setting. I read about WaitProperty function used in QTP and I am planning to use this function instead of Sync function.

Which approach is good? Is any other functions available in QTP to optimize the script?

Thanks.


Post Extras: Print Post   Remind Me!   Notify Moderator  
Bill42x
Advanced Member


Reged: 10/24/08
Posts: 428
Loc: Cambs, UK
Re: WaitProperty Vs Sync [Re: KMR_rajkumar]
      #555305 - 03/09/09 04:35 AM

Always use sync

Sync waits for the page to refresh properly, wait is just a hardcoded delay.

With wait, if the page is particularly fast, your test will be unecessarily slow, if the page is particularly slow your test will fail.

If you particularly need a specific control to be present on the page before you continue in your test then you could wait for that control by using .exist

--------------------
For QTP code, checkout my website:

http://www.intellipro.co.uk


Post Extras: Print Post   Remind Me!   Notify Moderator  
priyank1985
Member


Reged: 08/31/07
Posts: 56
Re: WaitProperty Vs Sync [Re: Bill42x]
      #555311 - 03/09/09 04:51 AM

Hi,

Refer below link that may help you.

http://qtp.blogspot.com/2007/09/qtp-sync-wait-and-synchronization.html

--------------------
Thanx,
Priyank Shah


Post Extras: Print Post   Remind Me!   Notify Moderator  
mwsrossoModerator
Veteran


Reged: 09/30/01
Posts: 4974
Loc: Doncaster, UK
Re: WaitProperty Vs Sync [Re: Bill42x]
      #555324 - 03/09/09 05:15 AM

Quote:

Always use sync

Sync waits for the page to refresh properly, wait is just a hardcoded delay.






He said WaitProperty Bill.

Mark Smith.


Post Extras: Print Post   Remind Me!   Notify Moderator  
Bill42x
Advanced Member


Reged: 10/24/08
Posts: 428
Loc: Cambs, UK
Re: WaitProperty Vs Sync [Re: mwsrosso]
      #555339 - 03/09/09 05:44 AM

Oops, sorry, my bad, I should read questions more carefully.

Yes, if you know what you need then waitproperty could be considered to be better than sync, especially if you're waiting on the return of a particular bit of data and don't want to wait while all the adverts load etc.

--------------------
For QTP code, checkout my website:

http://www.intellipro.co.uk


Post Extras: Print Post   Remind Me!   Notify Moderator  
abrakh
Junior Member


Reged: 10/17/05
Posts: 352
Re: WaitProperty Vs Sync [Re: Bill42x]
      #555347 - 03/09/09 05:59 AM

Another approach is using the exist function. At some occassions (in my application) the status bar does not show any activity or expecting a popup dialog etc. Then use the function .exist
the time by defualt is used the Object sync time in the settings. If you want you can customise it by passing the time in secs like
.exist(30) etc.

Hope this helps.


Post Extras: Print Post   Remind Me!   Notify Moderator  
linkdotbiz
Member


Reged: 07/23/07
Posts: 290
Loc: Amman, Jordan
Re: WaitProperty Vs Sync [Re: Bill42x]
      #555350 - 03/09/09 06:02 AM

In Other words, sync timesout but waitproperty doesn't, it keeps on waiting until the object displays. Both have their advantages/disadvantages.

If "Page cannot be displayed" pops up while waiting for an object to display, sync would timeout and show that the object doesn't exist [GOOD]. However waitproperty will keep on waiting like an infinite loop. [BAD]

If the page took a long time to reload after some user action, sync might time out and throw an error that the object wasn't found [BAD], but if waitproperty was used then it will keep on waiting for that object to display even if it took a little bit longer time to do so. [GOOD]

Edited by linkdotbiz (03/09/09 06:04 AM)


Post Extras: Print Post   Remind Me!   Notify Moderator  
JWP
Member


Reged: 05/21/07
Posts: 32
Re: WaitProperty Vs Sync [Re: linkdotbiz]
      #623441 - 04/22/10 09:04 AM

We just ran some analysis on Sync.. We believe this is what it does:

WebBrowser does get Request ---->
<--Server returns main web page
Sync is satisfied here...

Browser will parse web page.
Addtional gets for images etc.---->

Therefore what we've learned is that for subsequent click events (after Sync is satisfied) on a page where the images etc. don't yet exist, the test case will fail.

The solution is to check to see if object exists in a wait loop PRIOR to clicking.

Edited by JWP (04/22/10 09:29 AM)


Post Extras: Print Post   Remind Me!   Notify Moderator  
NoUse4aName
Super Member


Reged: 06/13/08
Posts: 1720
Re: WaitProperty Vs Sync [Re: linkdotbiz]
      #623443 - 04/22/10 09:16 AM

Quote:

In Other words, sync timesout but waitproperty doesn't, it keeps on waiting until the object displays.




That's not quite right. WaitProperty is still subject to the default object sync timeout. So if the object does not exist prior to that timeout, WaitProperty will throw an object not found error no matter how long its specified timeout is set for.

WaitProperty should only be used on objects that you already know exist(but you want to wait on a particular state "enabled" "visibile" "ready" etc.


Post Extras: Print Post   Remind Me!   Notify Moderator  
JWP
Member


Reged: 05/21/07
Posts: 32
Re: WaitProperty Vs Sync [Re: NoUse4aName]
      #623444 - 04/22/10 09:28 AM

I didn't mention waitproperty.

We just use Sync and a loop of object exist.

But we are new to this too.


Post Extras: Print Post   Remind Me!   Notify Moderator  
NoUse4aName
Super Member


Reged: 06/13/08
Posts: 1720
Re: WaitProperty Vs Sync [Re: JWP]
      #623459 - 04/22/10 10:07 AM

Right, my reply wasn't quoting you JWP.

Another option is to simply put whatever property you are waiting on into the object's identification properties.


Post Extras: Print Post   Remind Me!   Notify Moderator  
Veenit_Mavani
Newbie


Reged: 04/22/10
Posts: 1
Loc: India
Re: WaitProperty Vs Sync [Re: NoUse4aName]
      #623467 - 04/22/10 10:33 AM

Another interesting option is to check for the readyState property of the the Page object in a loop. If this property is either "Interactive" or "Complete", then the page is completely loaded. Until then you could keep calling Sync.

This way you would be double sure of Sync working. This can be useful especially if your framework is totally data driven and does not have feature to add WaitProperty or if the script is too long and adding too many waitproperty could be tedious.

--------------------
Veenit Mavani
Technology Enthusiast!


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 130 anonymous users are browsing this forum.

Moderator:  IanFraser, Rajkumar_Rajangam, thorwath, TReddy, AJ, Tarun Lalwani, mwsrosso 

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Topic views: 8334

Rate this topic

Jump to

Contact Us | Privacy statement SQAForums

Powered by UBB.threads™ 6.5.5