On 11-Jul-08, at 7:27 AM, Somesh Sasalatti wrote:

> I see that you change the code of     protected void notify(final  
> int eventType, final Event createEvent, final Widget widget) {}
>  in abstractswtbot.java which sleeps for a given time and gets back
> earlier it was running a sync thread

--- snippet ---

long playbackDelay = SWTBotPreferences.playbackDelay();
if (playbackDelay > 0)
     sleep(playbackDelay);

--- snippet ---

The sleep is merely to slow down execution for some users who'd like  
their tests to run slower at certain points and speed them up at  
times. This can be done by setting the value of the system variable  
"net.sf.swtbot.playback.delay" to some time in milliseconds.

The sleep defaults to 0, and therefore never sleeps, in all cases, and  
the behavior is the same as before in all cases.

> don't you think sleep is non-deterministic? if on some wizard i have  
> a button that i click which invokes a series of operations which can  
> potentially take minutes ( for example retrieving something from a  
> server )
> then i'd have to guess the time that it should sleep for before  
> asserting something in my non-ui thread
>
> the workarounds would be that I wait in the non-ui thread till some  
> condition is true.
>
> any better solution for this. if SWTbot has to replicate what the  
> user sees then the click() should return only when its done.


You are correct indeed, it'd be nice if SWTBot tests could execute on  
the UI thread, but unfortunately in case of dialogs etc, the display  
loop executes in the dialog, which blocks test execution, you could  
try running a simple "create java project" test, run it as a junit- 
plugin test and see that the test blocks when the dialog opens up.

> this was happening when the notify(){} code had a sync thread at the  
> end.
> thoughts?

I don't quite remember why I removed this line. I've put this back, my  
local tests pass, so things should be fine.

-- Ketan


-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
SWTBot-users mailing list
SWTBot-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swtbot-users
http://swtbot.org/ - a functional testing tool for SWT/Eclipse

Reply via email to