|Re: Non-RCP SWT-testing [message #523824 is a reply to message #523744]
||Mon, 29 March 2010 13:51
| Pascal G
Registered: July 2009
Göran Öberg wrote:|
> I am setting up a function test framework with SWTBot to be run from
> Hudson. The application under test is an application that is not RCP
> (due to some specific start-up issues) but just as heavily based on
> Eclipse, e.g. based on SWT.
> I have a couple of working smoke tests that runs ok from within Eclipse.
> However, as I created them using "Run as SWTBot Test", it seems they are
> assuming the application is a RCP. My problem is that I can not get them
> to work outside of Eclipse, from the command line or from ant.
> During my development of these first few tests I have found answers to
> several questions here in the forum, for example handling of
> context-menus, so I will call on the wisdom of the forum to help me with
> this question:
> Where can I find documentation or examples on the proper procedure for
> testing a generic SWT-based application with SWTBot? Examples using ant
> or even Hudson would be extra appreciated.
> Best regards
That's an interesting question! I think right now SWTBot does support
your use case partially. I'll try and give you information in this
answer, since I don't remember seeing any information related to this on
As of now, there is only generic helpers in SWTBot to launch RCP
applications or even Eclipse plug-ins because it relies on the OSGi
platform to find and launch the required application. In your case, this
isn't good, since you don't have an OSGi runtime. I think it's
impossible for SWTBot to provide a generic way to test SWT-only
application, without OSGi.
But, fear not, there might as well be a workaround for this! What I
think could be done is that you give another entry point to the JVM
(another main) which would launch your application in a separate thread,
THAT MUST BECOME THE UI THREAD, and then launch the SWTBot thread.
Something like this:
Runnable runnable = new Runnable()
public void run()
Thread uiThread = new Thread(runnable);
// Run the Junit test.
Now then, the "Run the Junit test" part depends on which version of
Junit you are using. I'm not too versed in the How To of this, but you
can take a peek at
for ideas. Or even someone else can give more information.
Hope this helps.
Pascal Gélinas | Software Developer
*Nu Echo Inc.*
http://www.nuecho.com/ | http://blog.nuecho.com/
*Because performance matters.*
Powered by FUDForum
. Page generated in 0.02212 seconds