Running Automated Tests with PDE Build
August 6th, 2007 | Published in Builds, Rich Client Platform, Testing | 59 Comments
In a previous post, I provided a set of projects that you could use to get a sample build running quickly. The idea was that getting your first build running is half the battle. From that point on, you can make small, incremental changes to accomplish what you like.
A common request I’ve received, though, is to provide a similar sample build that includes the running of JUnits using the Eclipse Test Framework. Well here it is! Just download and import the sample projects, and follow the directions in the included readme.txt file.
Note: If you want to run this sample build using Eclipse 3.2, you’ll need to work around a PDE Build defect. For instructions on how to do this, check out the “Problems parsing feature file in a product build” section on the PDE Build wiki page.



Patrick on the RCP Panel at EclipseCon
November 28th, 2007 at 7:23 am (#)
Hi,
thanks for this article. We need to get our build for an RCP app running under cruise so this should help.
I came across a project called Pluginbuilder which you might find interesting: http://www.pluginbuilder.org/
Channing
December 9th, 2007 at 10:16 am (#)
Hi Patrick,
Sorry about posting to the wrong article. You said:
> And when you say the test plugins are present, do you mean the plugins that come with the Ecilpse Testing Framework?
yes
> If those plugins are there, you should check the log to see if some dependency is not being met when the test plugins are resolving.
I’ve looked and cannot see anything in the logs.
> And remember, the test framework needs to run in a complete copy of the Eclipse SDK, not just the RCP runtime binary.
In fact, we are using a complete 3.3.1.1 eclipse sdk with the test plugins to build with. I am able to run up eclipse from the test directory, which contains our rcp app, the eclipse sdk and test plugins, but there is nothing in the logs to indicate that the plugins do not have unresolved dependencies.
I think I need to start from scratch again as I have obviously missed a step somewhere.
Perhaps Eclipse should adopt the pluginbuilder, or something like it, since the PDE build and tests are needed by anyone doing rcp or plugin development, and its very painful.
Channing
December 10th, 2007 at 6:11 pm (#)
Hi Channing,
I jsut went through the code again and it works for me on Windows XP. Are you running on a different platform? If so, you may need to modify some of the directory names in the build.properties file.
I’ve also updated the instructions to be a little clearer, and you may want to start from scratch and try again.
It also might help to email me the complete log output from the build process. My email address is listed in the “About Me” section.
— Patrick
July 18th, 2008 at 1:09 pm (#)
Hi Patrick,
Can you please tell me what this is? :
”
[echo] Running com.rcpquickstart.helloworld.HelloWorldModelTest. Result file: c:/helloworld-build/test/helloworld/results/com.rcpquickstart.helloworld.HelloWorldModelTest.xml.
[java] Class not found “com.rcpquickstart.helloworld.HelloWorldModelTest”
[java] Java Result: 2
collect-results:
[style] Warning: the task name is deprecated. Use instead.
[style] Transforming into c:\helloworld-build\test\helloworld\results
[concat] No existing resources and no nested text, doing nothing ”
My build is successful, but i can’t open the application. Can you please give me a suggestion what to do?
Thank you,
Dora
July 18th, 2008 at 6:29 pm (#)
Hi Dora,
This error is related to running the unit tests after the actual product build completes. It’s hard to say what’s going on without more information. If you’d like to email me your build.properties file, I’d be happy to take a look.
— Patrick
July 22nd, 2008 at 10:03 am (#)
Hi Patrick,
Thanks for the reply and sorry for not replying earlier,
I managed to solve the problem.
Dora
November 4th, 2008 at 5:56 pm (#)
Hi Patrick,
I’m tyring to get this example up and running under Eclipse 3.4 in linux, and while the build works fine (I can run the resulting application with out probelms), the testing step fails.
I’ve tried running the build script from:
* within eclipse, as suggested by the readme;
* from the command line with ‘ant’; and,
* from the command line with ‘java -jar -application org.eclipse.ant.core.antRunner test
All three approaches seem to result in the same thing. The core-test task spits out:
core-test:
java-test:
[echo] Running com.rcpquickstart.helloworld.HelloWorldModelTest. Result file: /home/rcreswick/helloworld-build/test/eclipse/results/com.rcpquickstart.helloworld.HelloWorldModelTest.xml.
[java] Java Result: 13
When running with -v, I can find the log, (full version here: http://pastebin.com/m322ba870 should be a valid url until 12/04/2008) and this seems to be the central problem:
java.lang.RuntimeException: Application “org.eclipse.test.coretestapplication” could not be found in the registry. The applications available are: com.rcpquickstart.helloworld.application, org.eclipse.equinox.app.error.
at org.eclipse.equinox.internal.app.EclipseAppContainer.startDefaultApp(EclipseAppContainer.java:242)
at org.eclipse.equinox.internal.app.MainApplicationLauncher.run(MainApplicationLauncher.java:29)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
at org.eclipse.core.launcher.Main.main(Main.java:30)
There are a number of other missing dependencies, so I copied those bundles into the helloworld-build-target/eclipse/plugins folder, but it hasn’t had any effect.
What do I need to do to get past this Java Result 13 error? (Presumably something with adding the coretestapplication so it can be found, but I’m at a loss as to how to do that).
Thanks!
Rogan
November 5th, 2008 at 4:49 pm (#)
Hi Rogan,
If you can run the application after building it, then your dependencies should be fine. After the build, your app along with the Eclipse Testing Framework is copied into a “test” directory. You may want to verify that the ETF is getting copied into the test environment properly. The core-test application exists in the org.eclipse.test plug-in, and if that plug-in is not present or not getting loaded, you will have problems.
If you’d like to send me the entire log output via email, I’d be happy to take a look.
— Patrick
November 5th, 2008 at 6:13 pm (#)
Hi Patrick,
Thanks for the quick reply!
I’ve gotten this to work by sticking a whole bunch of bundles into helloworld-build/test/eclipse before running `ant test`. They were:
org.apache.ant_1.7.0.v200803061910/
org.eclipse.equinox.security_1.0.1.R34x_v20080721.jar
org.eclipse.jface.text_3.4.1.r341_v20080827-1100.jar
org.eclipse.core.filesystem_1.2.0.v20080604-1400.jar
org.eclipse.core.net_1.1.0.I20080604.jar
org.eclipse.core.resources_3.4.1.R34x_v20080902.jar
org.eclipse.core.runtime.compatibility_3.2.0.v20071008.jar
org.eclipse.text_3.4.0.v20080605-1800.jar
org.eclipse.ui.forms_3.3.101.v20080708_34x.jar
org.eclipse.ui.ide_3.4.1.M20080903-2000.jar
org.eclipse.ui.ide.application_1.0.0.I20080603-2000.jar
org.eclipse.ui.navigator_3.3.101.M20080827-0800.jar
org.eclipse.ui.navigator.resources_3.3.101.M20080827-0800.jar
org.eclipse.ui.views_3.3.0.I20080509-2000.jar
org.eclipse.ui.views.properties.tabbed_3.4.1.M20080730-0800.jar
org.eclipse.ui.workbench.texteditor_3.4.1.r341_v20080827-1100.jar
org.eclipse.update.core_3.2.201.R34x_v20080714.jar
(I identified them by looking at the output of ‘ant -v test’, which write a log to helloworld-build/test/eclipse/results/com.rcpquickstart.helloworld.HelloWorldModelTest.txt )
Adding those to the SDK zip that is extracted to helloworld-build/test/eclipse made the build process work from end-to-end — with Junit 3.8.
I’m trying to get JUnit 4 to work now, by applying the patch found here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=153429
So far I have not had much success. Oddly, I’m running into a very similar exception now (currently running the tests directly from the workbench to get that level of functionality done first):
java.lang.RuntimeException: Application “org.eclipse.pde.junit.runtime.uitestapplication” could not be found in the registry. The applications available are: org.eclipse.equinox.app.error, org.eclipse.test.dispatcher.coretestapplication, org.eclipse.test.dispatcher.uitestapplication, org.eclipse.ui.ide.workbench, org.eclipse.update.core.standaloneUpdate, org.eclipse.update.core.siteOptimizer, com.rcpquickstart.helloworld.application.
at org.eclipse.equinox.internal.app.EclipseAppContainer.startDefaultApp(EclipseAppContainer.java:242)
at org.eclipse.equinox.internal.app.MainApplicationLauncher.run(MainApplicationLauncher.java:29)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
This is obviously outside the scope of your example, but I thought I’d post it here to see if you have any suggestions.
Thanks!
Rogan
November 5th, 2008 at 7:50 pm (#)
Hi Rogan,
All of those plug-ins should already be in the test environment if you start by copying in a fresh Eclipse SDK. That is what the build script attempts to do.
As for running JUnit 4 tests, I’ve never tried to apply the patch myself but I’ve worked with others who haven’t had much luck. You may want to ask for help on the Bugzilla entry itself and maybe the people providing the patch can offer help.
— Patrick
November 7th, 2008 at 2:36 am (#)
It would have been nice if Dora (above) described how she fixed her problem, because I am having the exact same problem :)
After struggling with the testing framework, I got it to build, only except I have this error:
java-test:
[echo] Running org.openiaml.model.tests.inference.LoadModelTestCase. Result file: c:/eclipse-33-test/results/org.openiaml.model.tests.inference.LoadModelTestCase.xml.
[java] Java Result: 2
The weird thing is that this occurs when loading a JWebUnit2 test case. If I use it to test something like “HelloWorld extends TestCase”, it runs fine.
November 7th, 2008 at 3:34 pm (#)
Hi Jevon,
I’ve never run JWebUnit2 tests with the ETF, but does it have dependencies that may not be available in the test environment after the build?
If you’d like to send me the log of your build output and also any stack trace generated in the unit test output, I’d be happy to take a look.
— Patrick
November 12th, 2008 at 2:38 pm (#)
Greetings to those struggling to get automated testing to work with 3.4. In the past, our process was as follows:
1) Build our plugin(s).
2) Copy our plugins to an eclipse installation (i.e. eclipse-SDK-3.4.1) that also contains the ETF plugins (i.e. eclipse-test-framework-3.4.1).
3) Launch the ETF with a test.xml file that invokes our JUnit test classes.
When we get to step 3, the launcher fails with Java 13 error.
Eclipse 3.4 contains changes for the new update manager (i.e. P2). This new functionality makes eclipse much more picky about what plugins it will load. You can’t just copy your plugin(s) into the eclipse plugin folder or even the dropin folder and then launch ETF – the framework will not see them and you’ll get the error.
To work around this, do the following:
1) Setup your test installation of eclipse (unzip eclipse-SDK and eclipse-test-framework to the same location).
2) Add any plugins that you depend on (but do not build) to this installation.
3) Startup the test installation. Run “Help->Software Updates->Update…” if you like.
4) Exit the test eclipse installation.
5) Build your plugins.
6) Place them in the dropins directory of your test installation.
7) Startup the test installation of eclipse. Make sure you can see your plugins when you choose “Help->About Eclipse SDK->Plug-in Details”. You may need to restart a couple of times. If you can’t see your plugins, you have a dependency problem that you need to fix.
8) Exit the test installation of eclipse. Remove your plugin(s) from the dropin directory. Then MAKE A ZIP OF THE TEST INSTALLATION.
Your automated build process should be changed to resemble the following:
1) Build your plugin(s).
2) Blow away the existing test environment and re-create it from the zip you saved in step 8) above.
3) Copy your plugin(s) to the dropin directory.
4) Launch ETF with your test.xml file. It should load your plugin(s) and run your test.
It’s important to run step 2 every time since even a successful invocation of ETF will hose the test environment so that it won’t work the next time.
November 14th, 2008 at 11:03 pm (#)
Hi Ed,
Thanks for the detailed instructions. I have not run into this issue with regular plugins yet, but I have had this problem with fragment-based tests. There are definitely P2 issues with ETF, and I’m wondering what it is about your set up that is causing the problem.
It would be nice to be able to track down exactly what triggers the problem and submit a Bugzilla entry. Have you had this problem when running the sample build that you can download on this post?
— Patrick
November 20th, 2008 at 4:25 pm (#)
Hi Patrick ,
i’m trying to build my plugin with the PDE export wizard in my .product file.
my problem is that i’m getting the following problem when i’m launching the app outside eclipse :
java.lang.RuntimeException: No application id has been found.
at org.eclipse.equinox.internal.app.EclipseAppContainer.startDefaultApp(EclipseAppContainer.java:236)
at org.eclipse.equinox.internal.app.EclipseAppContainer.start(EclipseAppContainer.java:98)
at org.eclipse.equinox.internal.app.Activator.addingService(Activator.java:112)
at org.osgi.util.tracker.ServiceTracker$Tracked.trackAdding(ServiceTracker.java:1064)
at org.osgi.util.tracker.ServiceTracker$Tracked.trackInitialServices(ServiceTracker.java:926)
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:330)
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:274)
at org.eclipse.equinox.internal.app.Activator.start(Activator.java:54)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:999)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:993)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:974)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:346)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:260)
at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:400)
at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:111)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:417)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:189)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findLocalClass(BundleLoader.java:340)
at org.eclipse.osgi.framework.internal.core.SingleSourcePackage.loadClass(SingleSourcePackage.java:37)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(BundleLoader.java:405)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:369)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:357)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:83)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at org.eclipse.core.internal.runtime.PlatformActivator.startAppContainer(PlatformActivator.java:47)
at org.eclipse.core.internal.runtime.PlatformActivator.start(PlatformActivator.java:32)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:999)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:993)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:974)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:346)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:350)
at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1118)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:634)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:508)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:282)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:468)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:195)
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:297)
!ENTRY org.eclipse.osgi 2 0 2008-11-20 16:02:58.842
!MESSAGE One or more bundles are not resolved because the following root constraints are not resolved:
!SUBENTRY 1 org.eclipse.osgi 2 0 2008-11-20 16:02:58.842
!MESSAGE Bundle update@plugins/org.apache.xerces_2.8.0.v200705301630.jar was not resolved.
!SUBENTRY 2 org.apache.xerces 2 0 2008-11-20 16:02:58.842
!MESSAGE Missing required bundle org.apache.xml.resolver_0.0.0.
!SUBENTRY 1 org.eclipse.osgi 2 0 2008-11-20 16:02:58.842
!MESSAGE Bundle update@plugins/EkipBPM_1.0.0.jar was not resolved.
!SUBENTRY 2 EkipBPM 2 0 2008-11-20 16:02:58.842
!MESSAGE Missing required bundle MyJars_0.0.0.
!ENTRY org.eclipse.osgi 2 0 2008-11-20 16:02:58.842
!MESSAGE The following is a complete list of bundles which are not resolved, see the prior log entry for the root cause if it exists:
!SUBENTRY 1 org.eclipse.osgi 2 0 2008-11-20 16:02:58.842
!MESSAGE Bundle update@plugins/EkipBPM_1.0.0.jar [5] was not resolved.
!SUBENTRY 2 EkipBPM 2 0 2008-11-20 16:02:58.842
!MESSAGE Missing required bundle MyJars_0.0.0.
!SUBENTRY 1 org.eclipse.osgi 2 0 2008-11-20 16:02:58.842
!MESSAGE Bundle update@plugins/org.apache.xerces_2.8.0.v200705301630.jar [21] was not resolved.
!SUBENTRY 2 org.apache.xerces 2 0 2008-11-20 16:02:58.842
!MESSAGE Missing required bundle org.apache.xml.resolver_0.0.0.
My Manifest.MF content is :
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: EkipBPM Plug-in
Bundle-SymbolicName: EkipBPM;singleton:=true
Bundle-Version: 1.0.0
Bundle-Activator: com.linedata.ekipgp.ui.workbench.Activator
Require-Bundle: org.eclipse.stp.bpmn,
org.eclipse.stp.bpmn.diagram,
org.eclipse.stp.bpmn.edit,
org.eclipse.ui.ide,
MyJars
Eclipse-LazyStart: false
When i try using the osgi console to diag my plugin i’m getting the following :
osgi> diag 881
initial@reference:file:../.ws/EkipBPM/ [881]
Missing required bundle org.eclipse.stp.bpmn_0.0.0.
Missing required bundle org.eclipse.stp.bpmn.diagram_0.0.0.
Missing required bundle org.eclipse.stp.bpmn.edit_0.0.0.
Missing required bundle org.eclipse.ui.ide_0.0.0.
My product is running under eclipse ide ,
How can i fix this ???:((
Best Regards ,
Dali.
November 20th, 2008 at 6:15 pm (#)
Hi Dali,
I’m assuming that your application is running from within the IDE and that you have those required plug-ins in your target platform. Is that correct?
It looks like there is also a problem with your MyJars plug-in. Is this plug-in included in your product configuration or in a feature listed there?
— Patrick
November 21st, 2008 at 9:04 am (#)
Oh my god !
indeed , it was the problem.
Thanx a lot.
December 10th, 2008 at 3:34 pm (#)
I’m trying to build a RCP app, and export the product with ant, using your example as a guide. I have been unsuccssful and I’m stuck at the moment. Is there any insight you might be able to give me. Here is my ant output:
Buildfile: C:\Documents and Settings\Administrator\Desktop\Backup\SIT_1.0\com.ibm.retail.test.messageTest.build\build.xml
init:
[copy] Copying 231 files to C:\SIT-build\plugins
pde-build:
[java] Buildfile: c:/eclipse/plugins/org.eclipse.pde.build_3.4.1.R34x_v20080805/scripts/productBuild/productBuild.xml
[java] main:
[java] preBuild:
[java] preSetup:
[java] checkLocalMaps:
[java] getMapFiles:
[java] [concat] No existing resources and no nested text, doing nothing
[java] postSetup:
[java] checkLocalBase:
[java] getBaseComponents:
[java] generateFeature:
[java] fetch:
[java] generateFeature:
[java] [eclipse.generateFeature] Some inter-plug-in dependencies have not been satisfied.
[java] [eclipse.generateFeature] Bundle com.ibm.retail.test.messageTest:
[java] [eclipse.generateFeature] Missing required plug-in org.eclipse.ui.workbench.texteditor_0.0.0.
[java] [eclipse.generateFeature] Missing required plug-in org.eclipse.ui.console_0.0.0.
[java] [eclipse.generateFeature] Missing required plug-in org.eclipse.jface.text_0.0.0.
[java] [eclipse.generateFeature] Bundle org.eclipse.core.filesystem.win32.x86:
[java] [eclipse.generateFeature] Host plug-in org.eclipse.core.filesystem_[1.1.0,2.0.0) has not been found.
[java] [eclipse.generateFeature] Bundle org.eclipse.core.net.win32.x86:
[java] [eclipse.generateFeature] Host plug-in org.eclipse.core.net_1.1.0 has not been found.
[java] [eclipse.generateFeature] Bundle org.eclipse.core.resources.win32.x86:
[java] [eclipse.generateFeature] Host plug-in org.eclipse.core.resources_[3.4.0,3.5.0) has not been found.
[java] [eclipse.generateFeature] Bundle org.eclipse.equinox.security.win32.x86:
[java] [eclipse.generateFeature] Host plug-in org.eclipse.equinox.security_[1.0.0,2.0.0) has not been found.
[java] [eclipse.generateFeature] Bundle org.eclipse.ui.win32:
[java] [eclipse.generateFeature] Host plug-in org.eclipse.ui.ide_[3.2.0,4.0.0) has not been found.
[java] [eclipse.generateFeature] Bundle org.eclipse.update.core.win32:
[java] [eclipse.generateFeature] Host plug-in org.eclipse.update.core_[3.0.0,4.0.0) has not been found.
[java] BUILD FAILED
[java] c:\eclipse\plugins\org.eclipse.pde.build_3.4.1.R34x_v20080805\scripts\productBuild\productBuild.xml:26: The following error occurred while executing this line:
[java] c:\eclipse\plugins\org.eclipse.pde.build_3.4.1.R34x_v20080805\scripts\productBuild\productBuild.xml:56: Unable to find plug-in: com.ibm.retail.test.messageTest. Please check the error log for more details.
[java] Total time: 3 seconds
BUILD FAILED
C:\Documents and Settings\Administrator\Desktop\Backup\SIT_1.0\com.ibm.retail.test.messageTest.build\build.xml:60: Java returned: 13
Total time: 12 seconds
It tells me that the my project plug-in can not be found. I can’t find it either. When is this created and where should it be located.
Thanks in advance for any help.
Andrew
December 10th, 2008 at 5:42 pm (#)
It looks like your plug-in is missing some dependencies in the build target. The three listed are:
* org.eclipse.ui.workbench.texteditor
* org.eclipse.ui.console
* org.eclipse.jface.text
These plug-ins are not part of the RCP Runtime Binary and you’ll need to copy them by hand from an Eclipse installation of the appropriate version.
Hope this helps,
— Patrick
December 11th, 2008 at 4:50 am (#)
Thanks Patrick and Ed. I’ve been struggling with getting the testing framework installed in the P2 world, and this has helped immensely.
December 11th, 2008 at 5:08 am (#)
Just to clarify a bit. I mostly followed Ed’s advice, but since I am running on a server headless and with no UI (all UI packets are forwarded to /dev/null), instead of starting up the eclipse to see if everything is installed, I ran the command:
eclipse -console
This brings up the osgi console and lets you know all sorts of fun facts about the state of the bundles in the installation.
December 28th, 2008 at 2:52 pm (#)
Regarding missing dependencies in the build target I’m seeing the same problem with another application I’m trying to build. When you’re saying “copy by hand” you mean from the eclipse SDK to the eclipse runtime folders? Seems a little awkward?
Thanks,
– Andi
December 29th, 2008 at 6:03 pm (#)
Hi Andi,
Anytime you build an application, you need to assemble the dependencies that you will compile and run against. Obviously tools like Maven offer solutions to this for non-RCP apps and the Eclipse team itself uses the concept of map files to draw various pieces into a build. I haven’t used map files myself, but you may want to look into it.
I do agree that it seems a bit awkward to copy files from an Eclipse install into your targets, but this has many benefits over building against the Eclipse SDK itself. I’ve outlined these benefits in other posts:
http://rcpquickstart.com/2008/04/21/why-create-a-custom-target-platform/
http://rcpquickstart.com/2008/04/29/rcp-target-platform-tips/
It’s really not so bad once you start managing your build and development targets in a methodical way.
— Patrick
January 16th, 2009 at 11:20 am (#)
I finally manage to get PDE working. But I have to unzip the RCP first, otherwise it doesn’t work (org.eclipse.test.coretestaporg.eclipse.test.coretestapplicationplication not found). I still get an exception, but the tests run anyway.Should I be concerned about this?
!ENTRY org.eclipse.equinox.p2.reconciler.dropins 4 0 2009-01-16 12:12:49.027
!MESSAGE
!STACK 0
org.osgi.framework.BundleException: State change in progress for bundle “reference:file:plugins/org.eclipse.equinox.p2.reconciler.dropins_1.0.2.R34x_v20080909.jar” by thread “Start Level Event Dispatcher”.
at org.eclipse.osgi.framework.internal.core.AbstractBundle.beginStateChange(AbstractBundle.java:1144)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.suspend(AbstractBundle.java:529)
at org.eclipse.osgi.framework.internal.core.Framework.suspendBundle(Framework.java:1104)
at org.eclipse.osgi.framework.internal.core.PackageAdminImpl.suspendBundle(PackageAdminImpl.java:281)
at org.eclipse.osgi.framework.internal.core.PackageAdminImpl.processDelta(PackageAdminImpl.java:416)
at org.eclipse.osgi.framework.internal.core.PackageAdminImpl.doResolveBundles(PackageAdminImpl.java:224)
at org.eclipse.osgi.framework.internal.core.PackageAdminImpl$1.run(PackageAdminImpl.java:162)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.eclipse.osgi.framework.internal.core.AbstractBundle$BundleStatusException
… 8 more
Root exception:
org.eclipse.osgi.framework.internal.core.AbstractBundle$BundleStatusException
at org.eclipse.osgi.framework.internal.core.AbstractBundle.beginStateChange(AbstractBundle.java:1144)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.suspend(AbstractBundle.java:529)
at org.eclipse.osgi.framework.internal.core.Framework.suspendBundle(Framework.java:1104)
at org.eclipse.osgi.framework.internal.core.PackageAdminImpl.suspendBundle(PackageAdminImpl.java:281)
at org.eclipse.osgi.framework.internal.core.PackageAdminImpl.processDelta(PackageAdminImpl.java:416)
at org.eclipse.osgi.framework.internal.core.PackageAdminImpl.doResolveBundles(PackageAdminImpl.java:224)
at org.eclipse.osgi.framework.internal.core.PackageAdminImpl$1.run(PackageAdminImpl.java:162)
at java.lang.Thread.run(Thread.java:619)
!ENTRY org.eclipse.equinox.p2.metadata.repository 4 0 2009-01-16 12:12:50.910
!MESSAGE ProvisioningEventBus could not be obtained. Metadata caches may not be cleaned up properly.
!ENTRY org.eclipse.equinox.p2.garbagecollector 4 0 2009-01-16 12:12:50.938
!MESSAGE ProvisioningEventBus service could not be obtained, CoreGarbageCollector will not function properly.
January 16th, 2009 at 5:13 pm (#)
Hi Markus,
Did this problem occur when you ran the basic example before changes were made to it? I’ve never seen these errors occur before, so I’m not sure exactly what’s going on. I’m also not sure what you mean by “unzip the RCP”. Do you mean unzip the RCP Runtime Binary archive? If so, then yes you’ll definitely need to do this to get things working.
— Patrick
January 16th, 2009 at 6:48 pm (#)
No, the basic example ran fine. This is from a project from scratch, where I used your PDE files as templates. With RCP I mean my RCP application.
January 16th, 2009 at 8:43 pm (#)
Hi Markus,
Ok. Well, you’ll definitely need to extract your RCP application into the test environment in order to run the tests. As for the errors, again I’m not sure what’s going on.
You should definitely make sure that your test environment is starting out with a clean copy of the Eclipse SDK, not a previously run instance. Old configuration data/cache can get in the way of running the tests.
If this isn’t the issue, you may want to ask on the RCP or Platform newsgroups to find out what these types of errors usually relate to.
— Patrick
January 17th, 2009 at 1:03 am (#)
Dear Patrick,
really value your feedback. Establishing the target environment (RCP binary + Delta pack) proves to be a challenge for me. I’ve setup a folder containing these.
Still, build process fails with apparently straightforward dependencies:
[java] [eclipse.generateFeature] Bundle org.eclipse.core.filesystem.win32.x86:
[java] [eclipse.generateFeature] Host plug-in org.eclipse.core.filesystem_[1.1.0,2.0.0) has not been found.
[java] [eclipse.generateFeature] Bundle org.eclipse.core.net.win32.x86:
[java] [eclipse.generateFeature] Host plug-in org.eclipse.core.net_1.1.0 has not been found.
[java] [eclipse.generateFeature] Bundle org.eclipse.core.resources.win32.x86:
[java] [eclipse.generateFeature] Host plug-in org.eclipse.core.resources_[3.4.0,3.5.0) has not been found.
[java] [eclipse.generateFeature] Bundle org.eclipse.equinox.launcher.win32.win32.x86:
[java] [eclipse.generateFeature] Bundle org.eclipse.equinox.security.win32.x86:
[java] [eclipse.generateFeature] Host plug-in org.eclipse.equinox.security_[1.0.0,2.0.0) has not been found.
[java] [eclipse.generateFeature] Bundle org.eclipse.swt.win32.win32.x86:
[java] [eclipse.generateFeature] Bundle org.eclipse.ui.win32:
[java] [eclipse.generateFeature] Host plug-in org.eclipse.ui.ide_[3.2.0,4.0.0) has not been found.
[java] [eclipse.generateFeature] Bundle org.eclipse.update.core.win32:
[java] [eclipse.generateFeature] Host plug-in org.eclipse.update.core_[3.0.0,4.0.0) has not been found.
Any ideas what these might be? Is there a particular trick I’m missing?
January 17th, 2009 at 1:49 am (#)
Hi andig,
These are pretty standard errors that show up in most builds, even successful ones. Can you post the end of the output where the build fails? Or else feel free to email me the whole log.
— Patrick
June 8th, 2009 at 3:07 pm (#)
Hi !
First of all, thanks for this example ! it’s very helpfull !
But I have a problem…
Some inter-plug-in dependencies have not been satisfied because, in plugin.xml, we said to take the last version of the plug-in, but, the build.xml wants the plug-in number 0.0.0, and the current version is (for example) 1.0.2…
What I Have to do ?
[java] [eclipse.generateFeature] Bundle com.test.side.Application.deployer.alfresco:
[java] [eclipse.generateFeature] Missing required plug-in com.test.side.Application.generator_0.0.0.
[java] [eclipse.generateFeature] Missing required plug-in com.test.side.Application.deployer_0.0.0.
and the current version of com.test.side.Application.generator is 1.0.12 and the same for com.test.side.Application.deployer
June 8th, 2009 at 7:32 pm (#)
I wouldn’t worry about the version numbers. Sometimes the PDE Build messages are not accurate that way.
Are you sure that the plug-in (and all of it’s dependencies are available during the build (either in the target platform or in your build directory)?
— Patrick
June 23rd, 2009 at 5:55 pm (#)
Hi Patrick,
We having a big problem to compile ower RCP application.
It’s developped under eclipse 3.5 RC3.
When we tryed to export the .product we have this error :
—————————————–
eclipse.buildId=I20090528-2000
java.version=1.6.0_11
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=fr_CA
Command-line arguments: -os win32 -ws win32 -arch x86 -clean
An error occurred while collecting items to be installed :
No repository found containing: binary,com.lq.sp.application.product_root.win32.win32.x86,1.0.0
session context was:(profile=profile, phase=org.eclipse.equinox.internal.provisional.p2.engine.phases.Collect, operand=, action=).
An exception stack trace is not available.
—————————————–
We also try to build with a command line using ANT build.xml (build.properties) and we had this error :
Java returned: 13
In the .log file, there is this explaination :
!SESSION 2009-06-22 10:01:37.926 ———————————————–
eclipse.buildId=unknown
java.version=1.6.0_11
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=fr_CA
Framework arguments: -application org.eclipse.ant.core.antRunner -buildfile C:/Build/spgGalileo/eclipse/plugins/org.eclipse.pde.build_3.5.0.v20090527-1800/scripts/productBuild/productBuild.xml -Dtimestamp=007
Command-line arguments: -application org.eclipse.ant.core.antRunner -buildfile C:/Build/spgGalileo/eclipse/plugins/org.eclipse.pde.build_3.5.0.v20090527-1800/scripts/productBuild/productBuild.xml -Dtimestamp=007
!ENTRY org.eclipse.osgi 4 0 2009-06-22 10:01:40.457
!MESSAGE Application error
!STACK 1
java.lang.RuntimeException: Application “org.eclipse.ant.core.antRunner” could not be found in the registry. The applications available are: org.eclipse.equinox.app.error.
at org.eclipse.equinox.internal.app.EclipseAppContainer.startDefaultApp(EclipseAppContainer.java:242)
at org.eclipse.equinox.internal.app.MainApplicationLauncher.run(MainApplicationLauncher.java:29)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
at org.eclipse.equinox.launcher.Main.main(Main.java:1287)
Do you have any idea about what is wrong…
If you have any question or if something is missing, don’t hesitate to ask us,
Best regards,
June 23rd, 2009 at 6:26 pm (#)
Hi Patrick,
For the first issue (exporting inside the IDE), is there a win32 fragment that it’s trying to find? Is that fragment available in your workspace or target platform? It’s hard to tell what’s going on without knowing more about your application.
For the second issue (exporting running headless), it appears that the antRunner task cannot be located. Are you sure that the ANT plugins are installed in the Eclipse SDK that is being executed? It appears that the application id is correct, so perhaps the plugin or one of its dependencies is missing.
— Patrick
July 2nd, 2009 at 9:36 am (#)
Hi Patrick,
thanx for your infomation. I have a rcp application and a headless build that builds a correct product. However, my eclipse 3.4 headless test results in java.lang.RuntimeException: Application “org.eclipse.test.uitestapplication” could not be found in the registry.
Therefore, I took your hello word headless test sources. Firstly your headless test ran with my 3.4 eclipse installation into the problem that some plugins were apparantly missing or could not be resolved. After defining the following customized config.ini this (possibly 3.4 specific) problem was solved.
#Product Runtime Configuration File
osgi.splashPath=platform:/base/plugins/de.creditreform.aaa.orbis.client.rcp.app
eclipse.application=de.creditreform.aaa.orbis.client.rcp.app.application
eclipse.product=de.creditreform.aaa.orbis.client.rcp.app.product
osgi.bundles=org.eclipse.equinox.preferences@1:start,org.eclipse.equinox.registry@1:start,org.eclipse.equinox.app@1:start,org.eclipse.core.contenttype@1:start,org.eclipse.equinox.common@1:start,org.eclipse.core.jobs@2:start,org.eclipse.core.runtime@3:start,org.eclipse.equinox.simpleconfigurator@4:start
org.eclipse.equinox.simpleconfigurator.configUrl=file:org.eclipse.equinox.simpleconfigurator/bundles.info
osgi.bundles.defaultStartLevel=5
org.eclipse.update.reconcile=false
However, now I face the same problem with your helloword headless test than I have with my own rcp application:
java.lang.RuntimeException: Application “org.eclipse.test.coretestapplication” could not be found in the registry. The applications available are: org.eclipse.equinox.app.error.
Any help greatly appricated!
Reik
July 2nd, 2009 at 10:54 am (#)
Corrections and Additions to my last post
The config.ini is actually:
#Product Runtime Configuration File
osgi.splashPath=platform:/base/plugins/com.rcpquickstart.helloworld
eclipse.application=com.rcpquickstart.helloworld.application
eclipse.product=com.rcpquickstart.helloworld.product
osgi.bundles=org.eclipse.equinox.preferences@1:start,org.eclipse.equinox.registry@1:start,org.eclipse.equinox.app@1:start,org.eclipse.core.contenttype@1:start,org.eclipse.equinox.common@1:start,org.eclipse.core.jobs@2:start,org.eclipse.core.runtime@3:start,org.eclipse.equinox.simpleconfigurator@4:start
org.eclipse.equinox.simpleconfigurator.configUrl=file:org.eclipse.equinox.simpleconfigurator/bundles.info
osgi.bundles.defaultStartLevel=5
org.eclipse.update.reconcile=false
Starting the tests reveals:
java.lang.RuntimeException: Application “org.eclipse.test.coretestapplication” could not be found in the registry.
Starting helloWorld.exe reveals:
java.lang.RuntimeException: Application “com.rcpquickstart.helloworld.application” could not be found in the registry. The applications available are: org.eclipse.equinox.app.error.
July 9th, 2009 at 7:08 pm (#)
Hi Reik,
Sorry for the delay in getting back to you. I think the best approach would be to start with a completely clean version of the example projects and get that building. Can you tell me what plug-ins were initially missing or unresolved (before changes to config.ini)?
Also, what version of Eclipse are you using to run the build?
— Patrick
July 22nd, 2009 at 11:25 am (#)
Hi Patrick,
back to work after holidays I picked up my old problem. My posted problems concerns Eclipse 3.4.2.
Meanwhile I learned two lessons:
1. Providing an own config.ini in the product configuration does not work even if the this file has the same content than the default file automatically created by Eclipse.
2. Using junit4 in the helloworld.test plugins causes that this plugin is not found during test.
I just did the following:
- I used option “Generate a default config.ini file”
- I removed the emma stuff that caused a problem
- I now moved your helloworld project to Eclipse 3.5.
- I totally avoided the use of junit4 (also with Eclipse 3.5)
Now the build creates a helloworld product that runs fine and the test runs without error. However, the later is not the case with my own application. The build works fine, but the tests runs into the following eclipse console output:
ui-test:
eclipse-test:
[echo] Library.xml executing target ‘eclipse-test’…
[echo] Eclipse-home for testing: c:/dev/orbisBuild/testOutput/eclipse
[echo] Result file: c:/dev/orbisBuild/testOutput/eclipse/results/de.creditreform.aaa.orbis.client.rcp.test.GlobalTestSuite.xml.
[echo] Data-dir: c:/dev/orbisBuild/testOutput/eclipse/junit-workspace -clean.
[echo] plugin-name: de.creditreform.aaa.orbis.client.rcp.test.
[echo] Running de.creditreform.aaa.orbis.client.rcp.test.GlobalTestSuite…
[exec] java.lang.Exception: Could not find plugin “de.creditreform.aaa.orbis.client.rcp.test”
[exec] at org.eclipse.test.EclipseTestRunner.loadSuiteClass(EclipseTestRunner.java:304)
[exec] at org.eclipse.test.EclipseTestRunner.getTest(EclipseTestRunner.java:237)
[exec] at org.eclipse.test.EclipseTestRunner.(EclipseTestRunner.java:220)
[exec] at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.java:204)
[exec] at org.eclipse.test.UITestApplication$3.run(UITestApplication.java:195)
[exec] at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
[exec] at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
[exec] at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3855)
[exec] at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3476)
[exec] at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
[exec] at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
[exec] at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
[exec] at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
[exec] at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
[exec] at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
[exec] at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
[exec] at de.creditreform.aaa.orbis.client.rcp.app.Application.start(Unknown Source)
[exec] at org.eclipse.test.UITestApplication.runApplication(UITestApplication.java:138)
[exec] at org.eclipse.test.UITestApplication.run(UITestApplication.java:60)
[exec] at org.eclipse.test.UITestApplication.start(UITestApplication.java:210)
[exec] at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
[exec] at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
[exec] at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
[exec] at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
[exec] at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
[exec] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[exec] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[exec] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[exec] at java.lang.reflect.Method.invoke(Unknown Source)
[exec] at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
[exec] at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
[exec] at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
[exec] Result: 2
Any idea appreciated!
Reik
July 22nd, 2009 at 9:12 pm (#)
Hi Reik,
Well according to the trace, the test bundle cannot be located. Are there any message earlier in the build related to this bundle (compilation, etc.)? Does the bundle depend on any others which may not have been copied to the test environment?
— Patrick
July 23rd, 2009 at 6:22 am (#)
Hi Patrick,
Thanks a lot for your suggestions. There are no earlier problems in the console. The test-bundle is part of the test-feature which is part of the application. Therefore it is compiled during the build which is successful.
A dependency is likely the problem, but I cannot guess which. By change I noticed that removing the junit-bundle from the test-feature, the test-bundle is found but – of course – the following problem exist:
Exception in thread “WorkbenchTestable” org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.NoClassDefFoundError: junit/framework/TestListener)
Any further hint?
Reik
July 23rd, 2009 at 3:39 pm (#)
Hi Reik,
It’s tough to say without more information. I would start by looking at dependency differences between your application and the sample one.
Also, try and strip out as much as possible from the the features you are building to simplify things. If you can get a simple build running then you can start to add other bundles back to the features.
— Patrick
July 27th, 2009 at 2:55 pm (#)
Hi Patrick,
I have it running now. I was wrong assuming the build result was correct. Additionaly, I didn’t have the overview about the growing number of features in the application under test and I noticed that the order defined for the features within a feature may be important.
My hints for others are:
1. Test manually and intensively whether the result of your headless test ist really ok. If not analyse it by the osgi console to detect missing dependencies.
2. Look carefully on the hierarchy of your features (if it is complex as in my case).
3. Plugins physically present are needless if not registered in a feature. Take care for all plugins!
Three questions would be good to be answered:
1. What is the meaning of the buildType. You used buildType=I for the hello world example. Why? What do the others? Where can I find information about this?
2. There are special plugin-Tests that start the ui, and there are common junit test (the core-tests, I think). Is it correct, that I have to execute them in different test runs with different application IDs for the application parameter?
3. You specify the hello world application ID in the parameter “testApplication”. For a product test, the product ID should be specified, shouldn’t it? Is there such a parameter?
Thank you very much for your answers
Reik
July 27th, 2009 at 5:56 pm (#)
Hi Reik,
1. Build type is just a prefix that will be used to name the artifact created by the build. You can use whatever you want. By tradition, values are N=nightly, I=integration, M=milestone.
2. You can incorporate multiple tests runs into a single ant target, but yes behind the scenes this will cause multiple launches of headless Eclipse applications.
3. Where is the “testApplication” parameter specified? I’m not seeing it.
— Patrick
July 28th, 2009 at 6:18 am (#)
Hi Patrick,
sorry, in your original sources this parameter is indeed not specified. I have introduced it myself because I performed a ui-test and needed the helloworld application to start. My question is, is this a correct product test? I would have assumed to specifiy a product instead of an application.
Reik
July 28th, 2009 at 4:40 pm (#)
Hi Reik,
I don’t see any problem specifying an application id instead of a product id. The product is really just adding some branding, so from a unit testing perspective you should be ok.
— Patrick
July 29th, 2009 at 9:26 am (#)
Thanks a lot!
Reik
October 2nd, 2009 at 1:27 am (#)
Hi Patrick,
I used your example and found it very useful. Using eclipse 3.5, managed to build the feature in the example.
Build is successful, but no executable file exists in the archive. Could you please tell me what the problem might be?
Regards,
Marius
October 2nd, 2009 at 1:42 am (#)
Nevermind, I will move the question to the appropriate topic. :)
December 4th, 2009 at 4:07 pm (#)
Hi Patrick,
Is it possible to run the tests with Junit 4?
I’ve only been able to run Junit 3 and keep getting a “junit.framework.AssertionFailedError: No tests found…” type of error as soon as I switch to Junit 4.
Is there a trick to get the test running with Junit 4?
Thanks
December 4th, 2009 at 4:16 pm (#)
Hi Laurent,
This was *finally* fixed just last week and will be available in Eclipse 3.6. Check out the Bugzilla entry for all the gory details.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=153429
— Patrick
December 4th, 2009 at 6:01 pm (#)
Thanks Patrick for the quick answer.
I just pulled one of the latest integration builds (eclipse-test-framework-I20091204-0800.zip) and still no luck…did you get a chance to try that yourself?
December 4th, 2009 at 9:38 pm (#)
Hi Laurent,
I have not tried this myself – haven’t had the time yet. If it’s not working for you it would probably be best to ask questions on the Bugzilla entry. I’m definitely interested to hear if you get this working or not, so please keep me posted.
— Patrick
December 7th, 2009 at 9:22 am (#)
Patrick,
I wasn’t thinking when trying the fix. I was only using the newer eclipse test framework zip. I would also need to move to the newer SDK in order to get this to work (but I can’t move up, for other reasons).
February 10th, 2010 at 10:25 am (#)
Hi Patrick,
Thanks for this article. It was very helpful. I tried the new eclipse Testing framework(3.6M4) with my JUnit4 test case and it was working.
Could you perhaps give me some suggestion on how to execute JUnit Plug-in tests from headless Build?
Thanks in advance.
Stefanko
February 10th, 2010 at 2:56 pm (#)
Hi Stefanko,
Unit tests are kicked off through Ant targets and must be run in a properly configured test environment. A sample Ant script can be downloaded via the link in the post, and I describe how to set this a test environment here:
http://www.modumind.com/2008/08/01/creating-a-test-environment-for-the-eclipse-testing-framework/
If these don’t answer your question, please feel free to clarify what you need to know.
— Patrick
February 11th, 2010 at 4:34 am (#)
Hi Patrick
Thank you for your quick reply. My question wasn’t enough clear, sorry for it.
I can run my tests from headless build but only as JUnit Tests, but not as JUnit Plug-in Tests. In the Eclipse IDE if I right click on test file there are two options in the ‘Run As’ popup menu:
1. JUnit Test
2. JUnit Plug-in Test
So my question is how to execute my test as a ‘JUnit Plug-in Test’ from headless build?
Another problem is that I have some plug-in relative file paths referenced from my JUnit tests. These relative refernces are working correctly if I run the JUnit test from eclipse IDE, but they are not correctly resolved when I run the same test from headless build.
Would you be so kind as to write me some hint how to solve these problems?
Thanks in advance.
Stefanko
February 11th, 2010 at 4:24 pm (#)
Hi Stefanko,
The Eclipse Testing Framework is specifically meant to run like ‘JUnit Plug-in Test’ in the IDE. It basically runs your unit tests inside of an OSGi framework. Again, setting this up is complex and I would refer you to the sample projects that can be downloaded here. The tests that run as part of the sample are running as plug-in tests, and you should be able to modify the sample to build and test your own plug-ins.
As far as relative file paths are concerned, what are they relative to? Or maybe a better way to approach this is to tell me what you’re trying to achieve with the paths. There are various OSGi and RCP API calls to manage storage locations depending on what you’re trying to do.
— Patrick
February 12th, 2010 at 3:30 am (#)
Hi Patrick,
Thank you for your quick reply again and excuse my disturbing you again. So I am using your sample for my Headless build process, but some part of the Eclipse Testing Framework side wasn’t clear . Now I understand it, thank you very much.
For example I have a JUnit test where I use a data file from a ‘res’ folder under the plug-ins root folder and I reference to it the following way:
new File(“res/TestData.txt”)
If I run this test from the IDE it works fine, but when I execute it from the headless build the path cannot be resolved.
I receive the following message:
error message=”Source ‘res\TestData.txt’ does not exist” type=”java.io.FileNotFoundException”
So do you have any suggestion how to reference plug-in relatively to this data file?
Thanks in advance.
Stefanko
February 12th, 2010 at 10:24 am (#)
Hi Stefanko,
To get access to a resource inside of your bundle, it’s best to do something like:
Bundle bundle = Platform.getBundle(“com.mybundle.id”);
URL url = bundle.getEntry(“path-to-resource”);
The getEntry method takes a path relative to the root of your bundle. In your case this would be “res/TestData.txt”.
Hope this helps,
— Patrick
February 16th, 2010 at 10:37 am (#)
Hi Patrick,
Thank you very much, and sorry for not replying earlier.
It was a great help. That’s solved my problem.
Stefanko