Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » "Hacking" an exported SWT product so it finds SWTBot
"Hacking" an exported SWT product so it finds SWTBot [message #642688] Thu, 02 December 2010 11:12 Go to next message
Geoff Bache is currently offline Geoff BacheFriend
Messages: 33
Registered: October 2010
Member
Hi all,

I'm sitting with an exported product made by a different group and would like to try out SWTBot on it as a proof of concept.

Now I realise that the right way to get this to work is to change the product file and rebuild it, but I wondered if there was some kind of quicker and dirtier way just so I can experiment without needing to learn their whole build environment.

I've dumped the SWTBot jar files in the plugins directory of the exported product and hoped I could poke in some configuration file somewhere there to make it find the application. I tried a few plausible-looking ones but no success so far.

Anyone know if there is any way to do this? Where is this "registry" it tells me about? (as in Application " org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplica tion " could not be found in the registry)

Regards,
Geoff
Re: "Hacking" an exported SWT product so it finds SWTBot [message #642702 is a reply to message #642688] Thu, 02 December 2010 12:37 Go to previous messageGo to next message
Pascal G is currently offline Pascal GFriend
Messages: 157
Registered: July 2009
Senior Member
On 10-12-02 06:13 AM, Geoff Bache wrote:
> Hi all,
>
> I'm sitting with an exported product made by a different group and would
> like to try out SWTBot on it as a proof of concept.
>
> Now I realise that the right way to get this to work is to change the
> product file and rebuild it, but I wondered if there was some kind of
> quicker and dirtier way just so I can experiment without needing to
> learn their whole build environment.
>
> I've dumped the SWTBot jar files in the plugins directory of the
> exported product and hoped I could poke in some configuration file
> somewhere there to make it find the application. I tried a few
> plausible-looking ones but no success so far.
>
> Anyone know if there is any way to do this? Where is this "registry" it
> tells me about? (as in Application "
> org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplica tion "
> could not be found in the registry)
>
> Regards,
> Geoff
>

Dumping jars in the plugin directory does not work (or works randomly,
go figure) since Eclipse 3.4. The new way to install plugins is to use
p2 director or the dropin folder for a more temporary solution. Dump
your jar files in the dropin folder and it *should* work. I've had some
cases where it doesn't and the solution was to poke around in the
Eclipse console (launching eclipse in the command-line with the -console
option) and install manually the jars. It's somewhat a trial and error
process, but here's the general idea:
(I'm using Linux, so forgive me if you're a Windows user)

$ ./eclipse -console
.... eclipse logging ...
$>ss
.... listing of eclipse plugins, swtbot's should be missing ...
$> install file:///path/to/eclipse/dropins/swtbot/jar/file.jar
Installed bundle id 222
$> start 222
.... Exception showing it misses some dependency ...
$> install file:///path/to/dependency/plugin/jar/file.jar
.... etc. etc. until you get it to work ...

Notice the file:// thing in the path after "install"? It's the protocol
spec (same as http://) and is needed because the path is actually an
URI. Under Windows, you would probably have something close to:
file://C:/path/to/eclipse (or is it backslash?)

This whole console thingy (and dropins folder) is part of Equinox (OSGi
implementation), so I think it should work with a product too, but I've
never tested it. If I'm not mistaken, all plugin management related
tools (p2 director included) is part of Equinox and is always bundled
with a product, but, once again, I've never tested it.

Hope this helps.
--
Pascal Gélinas | Software Developer
*Nu Echo Inc.*
http://www.nuecho.com/ | http://blog.nuecho.com/

*Because performance matters.*
Re: "Hacking" an exported SWT product so it finds SWTBot [message #642722 is a reply to message #642702] Thu, 02 December 2010 13:56 Go to previous messageGo to next message
Geoff Bache is currently offline Geoff BacheFriend
Messages: 33
Registered: October 2010
Member
Hi Pascal,

Thanks for your message. I'm using Eclipse 3.5.2 on Linux.

There was no "dropins" directory in the exported product. I created one and put the swtbot jars there. No effect at all.

So I tried your console thing and got a certain distance, and set about trying to install org.eclipse.swtbot.eclipse.junit4.headless_2.0.1.20101106_18 31-73ca7af-dev-e35

It complains about various swtbot dependencies, which I installed OK. But when several of these are resolved, and I try to start it again, it says:

org.osgi.framework.BundleException: The bundle could not be resolved. Reason: Missing Constraint: Import-Package: org.eclipse.ui; version="0.0.0"

If I do "ss" I can see amongst other things
68 ACTIVE org.eclipse.ui_3.5.2.M20100120-0800

What does it mean that it wants version 0.0.0, and can this really clash with 3.5.2?

Regards,
Geoff
Re: "Hacking" an exported SWT product so it finds SWTBot [message #642748 is a reply to message #642688] Thu, 02 December 2010 14:55 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

Hi,

If your product is p2-ready, the right way to achieve installation of SWTBot and your test bundle is to use p2 repositories and install your extensions from them using p2 director from command-line.
See http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/p2_director.html


Le 02/12/2010 12:13, Geoff Bache a écrit :
> Hi all,
>
> I'm sitting with an exported product made by a different group and would
> like to try out SWTBot on it as a proof of concept.
>
> Now I realise that the right way to get this to work is to change the
> product file and rebuild it, but I wondered if there was some kind of
> quicker and dirtier way just so I can experiment without needing to
> learn their whole build environment.
>
> I've dumped the SWTBot jar files in the plugins directory of the
> exported product and hoped I could poke in some configuration file
> somewhere there to make it find the application. I tried a few
> plausible-looking ones but no success so far.
>
> Anyone know if there is any way to do this? Where is this "registry" it
> tells me about? (as in Application "
> org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplica tion "
> could not be found in the registry)
>
> Regards,
> Geoff
>


--
Mickael Istria -- BonitaSoft S.A.
http://www.bonitasoft.com/products/BPM_download.php
Re: "Hacking" an exported SWT product so it finds SWTBot [message #642753 is a reply to message #642748] Thu, 02 December 2010 15:41 Go to previous messageGo to next message
Geoff Bache is currently offline Geoff BacheFriend
Messages: 33
Registered: October 2010
Member
Hi Mickael,

Forgive my ignorance but I didn't make this product. How can I tell by looking at it if it is p2-ready? Does the lack of a "dropins" directory imply that it isn't?

Regards,
Geoff
Re: "Hacking" an exported SWT product so it finds SWTBot [message #642787 is a reply to message #642722] Thu, 02 December 2010 16:34 Go to previous messageGo to next message
Pascal G is currently offline Pascal GFriend
Messages: 157
Registered: July 2009
Senior Member
On 10-12-02 08:56 AM, Geoff Bache wrote:
> Hi Pascal,
>
> Thanks for your message. I'm using Eclipse 3.5.2 on Linux.
>
> There was no "dropins" directory in the exported product. I created one
> and put the swtbot jars there. No effect at all.
>
> So I tried your console thing and got a certain distance, and set about
> trying to install
> org.eclipse.swtbot.eclipse.junit4.headless_2.0.1.20101106_18
> 31-73ca7af-dev-e35
>
> It complains about various swtbot dependencies, which I installed OK.
> But when several of these are resolved, and I try to start it again, it
> says:
>
> org.osgi.framework.BundleException: The bundle could not be resolved.
> Reason: Missing Constraint: Import-Package: org.eclipse.ui; version="0.0.0"
>
> If I do "ss" I can see amongst other things
> 68 ACTIVE org.eclipse.ui_3.5.2.M20100120-0800
>
> What does it mean that it wants version 0.0.0, and can this really clash
> with 3.5.2?
>
> Regards,
> Geoff
>

If I'm right, the 0.0.0 version is just a magic version that is supposed
to match any version.

As for the eclipse.ui dependency, I have no idea why it isn't working.
I'm also mystified as why the junit4.headless components require
org.eclipse.ui to work... it's supposed to not require the UI after all!

Probably that Mickael's solution (p2) is more appropriate then...

--
Pascal Gélinas | Software Developer
*Nu Echo Inc.*
http://www.nuecho.com/ | http://blog.nuecho.com/

*Because performance matters.*
Re: "Hacking" an exported SWT product so it finds SWTBot [message #642788 is a reply to message #642753] Thu, 02 December 2010 16:41 Go to previous messageGo to next message
Pascal G is currently offline Pascal GFriend
Messages: 157
Registered: July 2009
Senior Member
On 10-12-02 10:41 AM, Geoff Bache wrote:
> Hi Mickael,
>
> Forgive my ignorance but I didn't make this product. How can I tell by
> looking at it if it is p2-ready? Does the lack of a "dropins" directory
> imply that it isn't?
>
> Regards,
> Geoff
>

Isn't a product created with Eclipse 3.4 + is automatically p2-ready?

Anyways, try running the following command after removing your jars from
the dropins folder.

$/eclipse \
-application org.eclipse.equinox.p2.director \
-repository
http://download.eclipse.org/technology/swtbot/galileo/dev-bu ild/update-site/
\
-installIU
org.eclipse.swtbot.<package> .feature.group,org.eclipse.swtbot.eclipse.test.junit4.featur e.group


<package> is one of swt, eclipse or eclipse.gef, depending on your
SWTBot needs.


Hope this helps.
--
Pascal Gélinas | Software Developer
*Nu Echo Inc.*
http://www.nuecho.com/ | http://blog.nuecho.com/

*Because performance matters.*
Re: "Hacking" an exported SWT product so it finds SWTBot [message #642896 is a reply to message #642788] Fri, 03 December 2010 09:15 Go to previous messageGo to next message
Geoff Bache is currently offline Geoff BacheFriend
Messages: 33
Registered: October 2010
Member
Apparently my product was not p2-ready. The command failed because the application
"org.eclipse.equinox.p2.director" did not exist in the registry.

However, I ran it instead from my eclipse installation and used the "-destination" flag, and then it worked. I now have SWTBot installed and usable! Many thanks.

My only remaining problem is how to install my own jar file there. I'm working in Jython and have written a small eclipse application to enable this, much along the lines of the headless test runner. Is there an easy way to get p2 to install this there also?

A further question is whether this approach (using p2 to install SWTBot) isn't superior to the one suggested in the FAQ here

http://wiki.eclipse.org/SWTBot/FAQ#Can_I_test_an_exported_ec lipse_product

as it allows more of a separation of concerns, and means you don't have to mess with the build to make it work. Perhaps this alternative method should at least be described there also.
Re: "Hacking" an exported SWT product so it finds SWTBot [message #642912 is a reply to message #642896] Fri, 03 December 2010 09:29 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

Le 03/12/2010 10:16, Geoff Bache a écrit :
> My only remaining problem is how to install my own jar file there. I'm
> working in Jython and have written a small eclipse application to enable
> this, much along the lines of the headless test runner. Is there an easy
> way to get p2 to install this there also?

Is your jar file an OSGi bundles?

> A further question is whether this approach (using p2 to install SWTBot)
> isn't superior to the one suggested in the FAQ here
>
> http://wiki.eclipse.org/SWTBot/FAQ#Can_I_test_an_exported_ec lipse_product
>
> as it allows more of a separation of concerns, and means you don't have
> to mess with the build to make it work. Perhaps this alternative method
> should at least be described there also.

You're right. I'll update a few things on this page, feel free to update it to add the knowledge you got from your experience.


--
Mickael Istria -- BonitaSoft S.A.
http://www.bonitasoft.com/products/BPM_download.php
Re: "Hacking" an exported SWT product so it finds SWTBot [message #642913 is a reply to message #642896] Fri, 03 December 2010 10:27 Go to previous messageGo to next message
Geoff Bache is currently offline Geoff BacheFriend
Messages: 33
Registered: October 2010
Member
An update on installing my own jar file with p2: I created a product file, and then tried to use the p2 publisher like this to create my own p2 repository:

./eclipse -application org.eclipse.equinox.p2.publisher.ProductPublisher -metadataRepository file:///users/geoff/workspace_3.6/p2repository -artifactRepository file:///users/geoff/workspace_3.6/p2repository -productFile /users/geoff/workspace_3.6/org.eclipse.swtbot.testscript/pro ductforp2.product -flavor tooling

(org.eclipse.swtbot.testscript is my jython-swtbot plugin)

This apparently worked and created two xml files there. But when I try to then install it using p2, it can't find them:

/eclipse -application org.eclipse.equinox.p2.director -repository file:///users/geoff/workspace_3.6/p2repository -installIU org.eclipse.swtbot.testscript -consoleLog -destination /opt/geoff/eclipse_pws/PWS -profile profile
...
!MESSAGE The installable unit org.eclipse.swtbot.testscript has not been found.

Many thanks for any help,
Geoff
Re: "Hacking" an exported SWT product so it finds SWTBot [message #642915 is a reply to message #642912] Fri, 03 December 2010 10:31 Go to previous messageGo to next message
Geoff Bache is currently offline Geoff BacheFriend
Messages: 33
Registered: October 2010
Member
Mickael Istria wrote on Fri, 03 December 2010 04:29
Le 03/12/2010 10:16,
Is your jar file an OSGi bundles?



I believe so. I created it as an Eclipse plugin and it seems to have a bunch of bundle-information in MANIFEST.MF.

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Testscript
Bundle-SymbolicName: org.eclipse.swtbot.testscript; singleton:=true
Bundle-Version: 1.0.0.qualifier
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.swtbot.swt.finder
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: org.eclipse.swt.widgets,
org.eclipse.swtbot.eclipse.finder,
org.eclipse.swtbot.swt.finder,
org.eclipse.swtbot.swt.finder.utils,
org.eclipse.ui,
org.eclipse.ui.testing,
org.hamcrest.core
Bundle-ClassPath: .,
src/jython.jar

/Geoff
Re: "Hacking" an exported SWT product so it finds SWTBot [message #643329 is a reply to message #642913] Mon, 06 December 2010 13:26 Go to previous messageGo to next message
Pascal G is currently offline Pascal GFriend
Messages: 157
Registered: July 2009
Senior Member
On 10-12-03 05:27 AM, Geoff Bache wrote:
> An update on installing my own jar file with p2: I created a product
> file, and then tried to use the p2 publisher like this to create my own
> p2 repository:
>
> /eclipse -application org.eclipse.equinox.p2.publisher.ProductPublisher
> -metadataRepository file:///users/geoff/workspace_3.6/p2repository
> -artifactRepository file:///users/geoff/workspace_3.6/p2repository
> -productFile
> /users/geoff/workspace_3.6/org.eclipse.swtbot.testscript/pro
> ductforp2.product -flavor tooling
>
> (org.eclipse.swtbot.testscript is my jython-swtbot plugin)
>
> This apparently worked and created two xml files there.

They should be named artifacts.xml and contents.xml, right? Could you
post the content of these files? And also, wasn't there anything else
with the xml files? At least a plugins directory with some jar, and
maybe a feature directory with some other jar? (Or not, since you
exported a product.)

> /eclipse -application org.eclipse.equinox.p2.director -repository
> file:///users/geoff/workspace_3.6/p2repository -installIU
> org.eclipse.swtbot.testscript -consoleLog -destination
> /opt/geoff/eclipse_pws/PWS -profile profile
> ..
> !MESSAGE The installable unit org.eclipse.swtbot.testscript has not been
> found.
>
> Many thanks for any help,
> Geoff
>

Maybe your installable unit changed name. It might be
org.eclipse.swtbot.testscript.feature.group. Or not. The xml files could
tell us that though.

--
Pascal Gélinas | Software Developer
*Nu Echo Inc.*
http://www.nuecho.com/ | http://blog.nuecho.com/

*Because performance matters.*
Re: "Hacking" an exported SWT product so it finds SWTBot [message #643339 is a reply to message #643329] Mon, 06 December 2010 14:44 Go to previous message
Geoff Bache is currently offline Geoff BacheFriend
Messages: 33
Registered: October 2010
Member
Thanks for all the help. I've just this moment made this work.

I gave up on the Product Publisher and used the Features and Bundles publisher in the end which worked better for me. Now all working from Python in an exported product!

Regards,
Geoff
Previous Topic:How to access nested context menus of the SWT table in SWTBot?
Next Topic:Strange error
Goto Forum:
  


Current Time: Sat Apr 27 00:44:58 GMT 2024

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

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

Back to the top