Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » SWTBot for existing RCP application(SWTBot for existing RCP application)
SWTBot for existing RCP application [message #1278614] Thu, 27 March 2014 15:39 Go to next message
Stefan Miller is currently offline Stefan MillerFriend
Messages: 12
Registered: March 2014
Junior Member
Hi all,

I'm a SWTBot newbie, so please excuse me if this is a dumb question. In my first tests, I created a simple RCP application in my workspace and I could write my first SWTBot tests for this RCP application. This was not problematic.

However, next I would like to test an existing RCP application with SWTBot too. This means I have a folder with all the plugins and the .exe for starting the RCP application.

First of all, I tried to follow the tutorial at:
http://download.eclipse.org/technology/swtbot/docs/videos/beginners/SWTBotHeadlessTestingForNovices/

However, this tutorial seems to be outdated. Due to this, I had a look at
https://wiki.eclipse.org/SWTBot/Automate_test_execution#Installing_headless_Testing_Framework

According to "Installing_headless_Testing_Framework" I have to execute this command:
java -jar plugins/org.eclipse.equinox.launcher_*.jar -application org.eclipse.p2.director -consolelog -repository $SWTBOT_SITE -installIU org.eclipse.swtbot.eclipse.test.junit.feature.group -installIU org.hamcrest


In my concrete case I executed:
java -jar plugins/org.eclipse.equinox.launcher_*.jar -application org.eclipse.p2.director -consolelog -repository http://download.eclipse.org/technology/swtbot/releases/latest/ -installIU org.eclipse.swtbot.eclipse.test.junit.feature.group -installIU org.hamcrest


Anyway, I get the error message when executing that command in the eclipse folder which contains the plugins folder etc.:
java.lang.RuntimeException: Application "org.eclipse.p2.director" could not be found in the registry. The applications available are: org.eclipse.equinox.app.error, org.eclipse.ui.rcp.sample.application.


Before that, I created the product for the RCP mail example and exported it.

Was it right to execute that command in that folder?

If that would work, I thought I would need to install my tests (my test plugin?) into the application. Would it be enough to put the .jar of the test plugin into the plugins folder of the RCP application?

To sum it up, I would like to test my already packaged RCP application outside of my Eclipse workspace but I don't know what exactly to do in what order. I greatly appreciate any kind of help.

Thanks in advance,
Stefan
Re: SWTBot for existing RCP application [message #1278719 is a reply to message #1278614] Thu, 27 March 2014 19:09 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

On 03/27/2014 04:51 PM, Stefan Miller wrote:
> java.lang.RuntimeException: Application "org.eclipse.p2.director" could
> not be found in the registry. The applications available are:
> org.eclipse.equinox.app.error, org.eclipse.ui.rcp.sample.application.

This method to install artifacts is only valid if your application
contains the p2 director. In your case, you don't have p2 director, so
you'd rather try to install the swtbot bundles and their dependencies
with another method, such as copying files directly into your
application plugins/ directory.

> Was it right to execute that command in that folder?
> If that would work, I thought I would need to install my tests (my test
> plugin?) into the application. Would it be enough to put the .jar of the
> test plugin into the plugins folder of the RCP application?

That's worth trying...
--
Mickael Istria
My job: http://www.jboss.org/tools
My blog: http://mickaelistria.wordpress.com
My Tweets: http://twitter.com/mickaelistria
Re: SWTBot for existing RCP application [message #1279104 is a reply to message #1278614] Fri, 28 March 2014 08:32 Go to previous messageGo to next message
Stefan Miller is currently offline Stefan MillerFriend
Messages: 12
Registered: March 2014
Junior Member
Thanks for the quick answer. I now copied the following jars into the plugins folder of my RCP application:



    org.eclipse.swtbot.swt.finder_2.0.5.20111003_1754-3676ac8-dev-e36
    org.hamcrest.text_1.1.0.v20090501071000
    org.eclipse.swtbot.ant.optional.junit4_2.0.5.20111003_1754-3676ac8-dev-e36
    org.eclipse.swtbot.eclipse.ui_2.0.5.20111003_1754-3676ac8-dev-e36
    org.eclipse.swtbot.forms.finder_2.0.5.20111003_1754-3676ac8-dev-e36
    org.eclipse.swtbot.go_2.0.5.20111003_1754-3676ac8-dev-e36
    org.eclipse.swtbot.junit4_x_2.0.5.20111003_1754-3676ac8-dev-e36
    org.hamcrest.integration.source_1.1.0.v20090501071000
    org.hamcrest.integration_1.1.0.v20090501071000
    org.hamcrest.library.source_1.1.0.v20090501071000
    org.hamcrest.library_1.1.0.v20090501071000
    org.hamcrest.text.source_1.1.0.v20090501071000
    org.hamcrest_1.1.0.v20090501071000
    org.apache.log4j_1.2.13.v200903072027
    org.eclipse.swtbot.eclipse.core_2.0.5.20111003_1754-3676ac8-dev-e36
    org.eclipse.swtbot.eclipse.finder_2.0.5.20111003_1754-3676ac8-dev-e36
    org.eclipse.swtbot.eclipse.spy_2.0.5.20111003_1754-3676ac8-dev-e36
    org.easymock_2.4.0.v20090202-0900
    org.hamcrest.core.source_1.1.0.v20090501071000


And additionally I put the folder "org.eclipse.swtbot.eclipse.junit4.headless_2.0.5.20111003_1754-3676ac8-dev-e36" into the plugins folder.

I also put the .jar with the testclass into the plugins folder.

After that I executed the following command (based on https://wiki.eclipse.org/SWTBot/Automate_test_execution#Command-line)
java -Xms256M -Xmx768M -XX:MaxPermSize=1024M -jar <Path_To_App>/org.eclipse.ui.rcp.sample/target/eclipse/plugins/org.eclipse.equinox.launcher_*.jar
  -application org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplication -testApplication org.eclipse.ui.rcp.sample.product
  -data <Path_To_Workspace>/Workspace -testPluginName de.swtbot.tests formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,
  <Path_To_Xml_Result>/TestResults.xml formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter
  -className MyTestClass -os win32 -ws win32 -arch x86_64 -consoleLog -debug


As a result, I got the following error message:

java.lang.RuntimeException: Application "org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplication" could not be
found in the registry. The applications available are: org.eclipse.equinox.app.error, org.eclipse.ui.rcp.sample.application.

According to the troubleshooting page (https://wiki.eclipse.org/SWTBot/Troubleshooting) this usually means that the org.eclipse.swtbot.eclipse.core plugin is not part of the target platform. However, in my eclipse in which I exported the product, the plugin is part of the active target platform.

Any idea what I could do to get SWTBot running? I mainly just want to include SWTBot into an existing RCP application. For that I took the simple Mail RCP example provided by Eclipse.
Re: SWTBot for existing RCP application [message #1281027 is a reply to message #1279104] Mon, 31 March 2014 08:40 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

On 03/28/2014 09:32 AM, Stefan Miller wrote:
> As a result, I got the following error message:
>
> java.lang.RuntimeException: Application
> "org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplication" could
> not be
> found in the registry. The applications available are:
> org.eclipse.equinox.app.error, org.eclipse.ui.rcp.sample.application.

It's really difficult to setup an application that doesn't have p2
director... Do you have some p2 plugins in your application? Such as the
"dropins" one? If so you should try to put those plugins in the dropins/
folder.
Also, do you have the OSGi console plugin in your app? It could be
interesting to start the application with "-console" option and to use
the console to check whether SWTBot bundles are visible, and can be
started, and if they can't, why.

> According to the troubleshooting page
> (https://wiki.eclipse.org/SWTBot/Troubleshooting) this usually means
> that the org.eclipse.swtbot.eclipse.core plugin is not part of the
> target platform. However, in my eclipse in which I exported the product,
> the plugin is part of the active target platform.

What do you mean by "is part"? Is it detected by the OSGi runtime?

It would be very helpful for other people if you could enrich this wiki
page with your experience and what you think can help other people in
the same case.

--
Mickael Istria
My job: http://www.jboss.org/tools
My blog: http://mickaelistria.wordpress.com
My Tweets: http://twitter.com/mickaelistria
Re: SWTBot for existing RCP application [message #1281711 is a reply to message #1281027] Tue, 01 April 2014 08:44 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 31/03/2014 10:40, Mickael Istria wrote:
> On 03/28/2014 09:32 AM, Stefan Miller wrote:
>> As a result, I got the following error message:
>>
>> java.lang.RuntimeException: Application
>> "org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplication" could
>> not be
>> found in the registry. The applications available are:
>> org.eclipse.equinox.app.error, org.eclipse.ui.rcp.sample.application.
>
> It's really difficult to setup an application that doesn't have p2
> director... Do you have some p2 plugins in your application? Such as the
> "dropins" one? If so you should try to put those plugins in the dropins/
> folder.

you could use the standalone director application

http://www.eclipse.org/downloads/download.php?file=/tools/buckminster/products/director_latest.zip

to install features in your rcp application.

cheers
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book


Re: SWTBot for existing RCP application [message #1282565 is a reply to message #1281027] Wed, 02 April 2014 13:57 Go to previous messageGo to next message
Stefan Miller is currently offline Stefan MillerFriend
Messages: 12
Registered: March 2014
Junior Member
Mickael Istria wrote on Mon, 31 March 2014 04:40

It's really difficult to setup an application that doesn't have p2
director... Do you have some p2 plugins in your application? Such as the
"dropins" one? If so you should try to put those plugins in the dropins/
folder.
Also, do you have the OSGi console plugin in your app? It could be
interesting to start the application with "-console" option and to use
the console to check whether SWTBot bundles are visible, and can be
started, and if they can't, why.


Thanks for your additional answers. Unfortunately I don't have access to my laptop right now, so that I can't test new things. However, I also tested the steps with a p2 application. Executing the java -jar plugins/... command leads to this
error message:

java.lang.RuntimeException: Application {0} could not be
found in the registry. The applications available are: 
org.eclipse.ant.core.antRunner, org.eclipse.emf.codegen.CodeGen, org.eclipse.emf.codegen.JMerger, org.eclipse.emf.
codegen.ecore.Generator, org.eclipse.emf.mwe.core.WorkflowRunner, org.eclipse.equinox.app.error, org.eclipse.equinox.p2.
director.app.application, org.eclipse.equinox.p2.director, org.eclipse.equinox.p2.garbagecollector.application, org.ecli
pse.help.base.infocenterApplication, org.eclipse.help.base.helpApplication, org.eclipse.help.base.indexTool, org.eclipse
.jdt.core.JavaCodeFormatter, org.eclipse.pde.build.Build


I found a thread indicating that the config.ini of the application is not setup properly. Anyway, the config.ini of that application has set the correct eclipse.product and eclipse.application property.

I'm not sure about the OSGi console. I will have to read on this at first, as I don't know what you mean at the moment. Basically I just set up the Eclipse Mail RCP project without changing it. Then I created a product configuration and exported that product. With that one I tried to execute the steps. Does this help you?

Quote:

> According to the troubleshooting page
> (https://wiki.eclipse.org/SWTBot/Troubleshooting) this usually means
> that the org.eclipse.swtbot.eclipse.core plugin is not part of the
> target platform. However, in my eclipse in which I exported the product,
> the plugin is part of the active target platform.

What do you mean by "is part"? Is it detected by the OSGi runtime?

It would be very helpful for other people if you could enrich this wiki
page with your experience and what you think can help other people in
the same case.


With "part" I mean that in my Eclipse that plugin is listed as contained in the target platform.

I think I will execute the steps again with a fresh Eclipse and the simple Mail RCP example from Eclipse again to make sure that I did not forget anything. Then I can try to collect my experiences.

Thank you very much for your help.

Re: SWTBot for existing RCP application [message #1282659 is a reply to message #1282565] Wed, 02 April 2014 16:33 Go to previous message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

On 04/02/2014 03:57 PM, Stefan Miller wrote:
> Thanks for your additional answers. Unfortunately I don't have access to
> my laptop right now, so that I can't test new things. However, I also
> tested the steps with a p2 application. Executing the java -jar
> plugins/... command leads to this error message:
>
> java.lang.RuntimeException: Application {0} could not be
> found in the registry. The applications available are:
> org.eclipse.ant.core.antRunner, org.eclipse.emf.codegen.CodeGen,
> org.eclipse.emf.codegen.JMerger, org.eclipse.emf.
> codegen.ecore.Generator, org.eclipse.emf.mwe.core.WorkflowRunner,
> org.eclipse.equinox.app.error, org.eclipse.equinox.p2.
> director.app.application, org.eclipse.equinox.p2.director,
> org.eclipse.equinox.p2.garbagecollector.application, org.ecli
> pse.help.base.infocenterApplication,
> org.eclipse.help.base.helpApplication, org.eclipse.help.base.indexTool,
> org.eclipse
> jdt.core.JavaCodeFormatter, org.eclipse.pde.build.Build

What's the full command-line you're using?


--
Mickael Istria
My job: http://www.jboss.org/tools
My blog: http://mickaelistria.wordpress.com
My Tweets: http://twitter.com/mickaelistria
Previous Topic:Gird in view
Next Topic:Using SWTBot for Eclipse tutoring
Goto Forum:
  


Current Time: Sat Apr 20 00:03:43 GMT 2024

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

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

Back to the top