Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Alternate for sleep()
Alternate for sleep() [message #633961] Wed, 20 October 2010 04:18 Go to next message
Nyna  is currently offline Nyna
Messages: 10
Registered: October 2010
Junior Member
Hi
Can anyone suggest me an alternate for the sleep() method.. heard about waitUntil(). Can anyone please explain.

Thanks in advance Smile
Re: Alternate for sleep() [message #633990 is a reply to message #633961] Wed, 20 October 2010 08:19 Go to previous messageGo to next message
Mariot Chauvin is currently offline Mariot Chauvin
Messages: 174
Registered: July 2009
Senior Member
Hi Nyna,

Comments below.

Nyna a écrit :
> Hi
> Can anyone suggest me an alternate for the sleep() method.. heard
> about waitUntil(). Can anyone please explain.
>
> Thanks in advance :)

When you plan to use "sleep", this is for waiting something, for
instance a button enablement, a dialog display or a background job to
end. If you use the sleep method you will specify an amount of time. The
duration will depend on your computer performance and workload. In other
words, the test may work on your computer at this time but will fail in
othercase.
The "waituntil" method allows you to use a condition rather than a
duration. Until the condition is checked, the test will wait.
In other words, the test will work on any computer at any time.
Hope this help,

Regards,

Mariot

--
Mariot Chauvin @ Obeo

http://www.obeo.fr
http://mariot-thoughts.blogspot.com
http://fr.linkedin.com/in/mariotchauvin
Re: Alternate for sleep() [message #634269 is a reply to message #633990] Thu, 21 October 2010 05:06 Go to previous messageGo to next message
Nyna  is currently offline Nyna
Messages: 10
Registered: October 2010
Junior Member
Hi Mariot,
Thanks a lot for the reply..


Regards,
Nyna Smile
Re: Alternate for sleep() [message #634320 is a reply to message #634269] Thu, 21 October 2010 09:22 Go to previous messageGo to next message
Nyna  is currently offline Nyna
Messages: 10
Registered: October 2010
Junior Member
Hi Mariot,
Can you also suggest how to wait for a node to expand and access its children by using waitUntil().. what can be the condition?

Thanks in advance Smile

Regards,
Nyna Smile
Re: Alternate for sleep() [message #634326 is a reply to message #634320] Thu, 21 October 2010 09:40 Go to previous messageGo to next message
Mariot Chauvin is currently offline Mariot Chauvin
Messages: 174
Registered: July 2009
Senior Member
Comments below.

Nyna a écrit :
> Hi Mariot,
> Can you also suggest how to wait for a node to expand and
> access its children by using waitUntil().. what can be the condition?
>
> Thanks in advance :)
>
> Regards,
> Nyna :)
....
final SWTBotTreeItem item = ...
item.expand();

bot.waitUntil(new DefaultCondition() {
public boolean test() {
return item.isExpanded();
}

public String getFailureMessage() {
return "item does not expand";
}

});

Off course you could create a generic class for tree item expansion
condition, your code will be easier to read :

final SWTBotTreeItem item = ...
item.expand();
bot.waitUntil(new WaitForItemExpansion(item));

Regards,

Mariot

--
Mariot Chauvin @ Obeo

http://www.obeo.fr
http://mariot-thoughts.blogspot.com
http://fr.linkedin.com/in/mariotchauvin
Re: Alternate for sleep() [message #634507 is a reply to message #634326] Fri, 22 October 2010 03:11 Go to previous messageGo to next message
Nyna  is currently offline Nyna
Messages: 10
Registered: October 2010
Junior Member
Hi Mariot,
Thanks a lot for your help Smile
Re: Alternate for sleep() [message #634513 is a reply to message #634507] Fri, 22 October 2010 03:38 Go to previous messageGo to next message
Nyna  is currently offline Nyna
Messages: 10
Registered: October 2010
Junior Member
Hi Mariot,


When I have to wait for a button to get enabled I use

bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Next >")), 30000);

But to wait for a node to get expanded why doesnt this work?

bot.waitUntil(Conditions.widgetIsEnabled(treeItem3.expand()) , 30000);
Re: Alternate for sleep() [message #635790 is a reply to message #634513] Thu, 28 October 2010 07:03 Go to previous message
Ullas is currently offline Ullas
Messages: 10
Registered: September 2010
Location: Bangalore
Junior Member
Hi Mariot,

I tried to implement the waitUntil() as you mentioned above.Please can you check the message - [ Issue in waiting for tree expansion [message #635771]].

I am facing some issues with this approach. Your help would be appreciated.

Thanks,
Ullas
Previous Topic:SWTBot tests using Jython
Next Topic:Automating the launch of SWTBot tests with Ant
Goto Forum:
  


Current Time: Thu Oct 23 13:08:15 GMT 2014

Powered by FUDForum. Page generated in 0.02062 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software