+1. I would love to have this background execution feature, in SWTBot. 
In addition to what you mention, it would also allow you to parallelize 
tests, which is a *big* win.

Your assessment of the problem is also correct, the notion of 'active 
shell' is what is keeping SWTBot back. SWTBot always looks up widgets in 
the active shell.

There's two issues in the new feature request that you mention here:
1. maintaining state about the active window.
2. being able to send events using display.post for certain types of 
events and widget.notifyListeners for some other types of listeners.

I do have some ideas about internally maintain some information about 
the active shell:
1. Add a display filter (or listener) that keeps track of the active shell.
2. Have the user *explicitly* declare the active shell whenever the user 
expects the shell to change, e.g. after clicking finish on some dialog.

There could be more to this list.

However the one thing that does get into the way of checking emails 
while running tests is the fact that new swt windows always open up in 
the foreground, and there's no way for SWTBot to open them up in a 
'minimized' state.


Reg being able to send events using display.post and 
widget.notifyListeners, I think something like Simon Stewart's Webdriver 
(http://code.google.com/p/webdriver/) might be of help.

Webdriver is slated to become selenium 2.0, and does a lot of ground 
breaking stuff. It uses specific implementations for a particular os, 
and browser implementation. This allows drivers to do something 
different with each browser/os implementation. I feel this is one way 
that SWTBot could take in order to do stuff across platforms, since that 
is the only other way to go about things.

Here's an implementation for safari on macosx 
http://code.google.com/p/webdriver/source/browse/trunk/safari/src/java/org/openqa/selenium/safari/SafariWebElement.java

public void sendKeys(CharSequence... value) {
     StringBuilder builder = new StringBuilder();
     for (CharSequence seq : value)
         builder.append(seq);

     appleScript.executeJavascript(locator + ".focus()");
     appleScript.executeApplescript(
                     "tell application \"System Events\"\r" +
                     "    keystroke (\"" + builder.toString() + "\")\r" +
                     "end tell");
     appleScript.executeJavascript(locator + ".blur()");
}

And and yet another implementation for ie on windows that goes native 
(http://code.google.com/p/webdriver/source/browse/trunk/jobbie/src/java/org/openqa/selenium/ie/InternetExplorerElement.java)
private native void doSendKeys(String string);

-- Ketan

Phil Quitslund wrote:
> Hey all,
> 
> A bit of a question about philosophy.  One of the things that really 
> interested 
> me when I saw that SWTBot dispatches events directly to the widgets 
> themselves 
> (vs. the Display) is the idea that perhaps tests could be run in the 
> "background" --- which is to say without requiring keyboard focus or control 
> of 
> the mouse.  This is a perk since it means one can run tests while continuing 
> to 
> code, check mail, etc.  Is this a desired property?  In practice, I'm seeing 
> some things in the implementation (notably how the "active shell" is derived) 
> that pull against this idea so I wonder if I was just under a mistaken 
> impression.  Anyway, I'm curious if this is a feature that is even on the 
> radar. 
>   Do other folks think this would be valuable?  General thoughts?
> 
> Thanks!
> 
> 
> -phil
> 
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> 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
> 


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
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