Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » java.lang.ClassCastException when running SWTBot tests in headless mode
java.lang.ClassCastException when running SWTBot tests in headless mode [message #654980] Thu, 17 February 2011 20:56 Go to next message
Jiri Janecek is currently offline Jiri JanecekFriend
Messages: 12
Registered: February 2011
Junior Member
Hi all,

at the moment I am playing with SWTBot which I think is great tool. Everything is working like a charm when running the tests from Eclipse. But when I try to run the tests in headless mode on exported RCP app I am facing serious problem.

RCP app starts correctly but no test is performed on it.

There is this exception in the console:
[java] Exception in thread "WorkbenchTestable" java.lang.NoClassDefFoundError junit/framework/TestListener


which seems to be raised often (Troubleshooting section of SWTBot)

But in the log of the test there is other exception:

java.lang.ClassCastException: "<NameofTheClass>" cannot be cast to org.eclipse.core.commands.IHandler
	at org.eclipse.ui.internal.handlers.HandlerProxy.loadHandler(HandlerProxy.java:334)
	at org.eclipse.ui.internal.handlers.HandlerProxy.isEnabled(HandlerProxy.java:304)
	at org.eclipse.core.commands.Command.isEnabled(Command.java:833)
	at org.eclipse.core.commands.Command.setHandler(Command.java:996)
	at org.eclipse.ui.internal.handlers.HandlerAuthority.updateCommand(HandlerAuthority.java:459)
	at org.eclipse.ui.internal.handlers.HandlerAuthority.activateHandler(HandlerAuthority.java:249)
	at org.eclipse.ui.internal.handlers.HandlerService.activateHandler(HandlerService.java:120)
	at org.eclipse.ui.internal.handlers.HandlerService.activateHandler(HandlerService.java:112)
	at org.eclipse.ui.internal.handlers.HandlerService.activateHandler(HandlerService.java:107)
	at org.eclipse.ui.internal.handlers.HandlerPersistence.readDefaultHandlersFromRegistry(HandlerPersistence.java:250)
	at org.eclipse.ui.internal.handlers.HandlerPersistence.reRead(HandlerPersistence.java:204)
	at org.eclipse.ui.internal.handlers.HandlerPersistence.read(HandlerPersistence.java:158)
	at org.eclipse.ui.internal.handlers.HandlerService.readRegistry(HandlerService.java:186)
	at org.eclipse.ui.internal.handlers.HandlerServiceFactory.create(HandlerServiceFactory.java:61)
	at org.eclipse.ui.internal.services.WorkbenchServiceRegistry.getService(WorkbenchServiceRegistry.java:102)
	at org.eclipse.ui.internal.services.ServiceLocator.getService(ServiceLocator.java:174)
	at org.eclipse.ui.internal.Workbench$43.runWithException(Workbench.java:1675)
	at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
	at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:178)
	at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
	at org.eclipse.swt.widgets.Display.syncExec(Display.java:4251)
	at org.eclipse.ui.internal.StartupThreading.runWithoutExceptions(StartupThreading.java:94)
	at org.eclipse.ui.internal.Workbench.initializeDefaultServices(Workbench.java:1671)
	at org.eclipse.ui.internal.Workbench.init(Workbench.java:1318)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2312)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:488)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at com.pikeelectronic.tibco.makedoc.gui.rcp.impl.Application.start(Unknown Source)
	at org.eclipse.swtbot.eclipse.junit4.headless.UITestApplication.start(UITestApplication.java:53)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
	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)
Application Started: 4985

!ENTRY org.eclipse.equinox.p2.ui.sdk 2 0 2011-02-17 21:36:47.625
!MESSAGE Could not locate the running profile instance


Target class is not implementing IHandler interface, but I don't understand why it is necessary to cast when in Eclipse everything is working well.

Using SWTBot 2.0.2 and Eclipse 3.4.0.

Any help will be appreciated.

JJ

[Updated on: Thu, 17 February 2011 21:01]

Report message to a moderator

Re: java.lang.ClassCastException when running SWTBot tests in headless mode [message #655091 is a reply to message #654980] Fri, 18 February 2011 10:03 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,

The java.lang.NoClassDefFoundError junit/framework/TestListener probably happens because you are missing a swtbot.junit fragment. I suggest you to start your tests with OSGi console enabled (just add the -console option on your command-line), and to investigate to understand why you cannot get SWTBot starting correctly.

HTH

Le 17/02/2011 21:56, Jiri Janecek a écrit :
> Hi all,
>
> at the moment I am playing with SWTBot which I think is great tool. Everything is working like a charm when running the tests from Eclipse. But when I try to run the tests in headless mode on exported RCP app I am facing serious problem.
>
> RCP app starts correctly but no test is performed on it.
>
> There is this exception in the console:
>
> [java] Exception in thread "WorkbenchTestable" java.lang.NoClassDefFoundError junit/framework/TestListener
>
>
> which seems to be raised often (Troubleshooting section of SWTBot)
>
> But in the log of the test there is other exception:
>
>
> java.lang.ClassCastException: "<NameofTheClass>" cannot be cast to org.eclipse.core.commands.IHandler
> at org.eclipse.ui.internal.handlers.HandlerProxy.loadHandler(Ha ndlerProxy.java:334)
> at org.eclipse.ui.internal.handlers.HandlerProxy.isEnabled(Hand lerProxy.java:304)
> at org.eclipse.core.commands.Command.isEnabled(Command.java:833 )
> at org.eclipse.core.commands.Command.setHandler(Command.java:99 6)
> at org.eclipse.ui.internal.handlers.HandlerAuthority.updateComm and(HandlerAuthority.java:459)
> at org.eclipse.ui.internal.handlers.HandlerAuthority.activateHa ndler(HandlerAuthority.java:249)
> at org.eclipse.ui.internal.handlers.HandlerService.activateHand ler(HandlerService.java:120)
> at org.eclipse.ui.internal.handlers.HandlerService.activateHand ler(HandlerService.java:112)
> at org.eclipse.ui.internal.handlers.HandlerService.activateHand ler(HandlerService.java:107)
> at org.eclipse.ui.internal.handlers.HandlerPersistence.readDefa ultHandlersFromRegistry(HandlerPersistence.java:250)
> at org.eclipse.ui.internal.handlers.HandlerPersistence.reRead(H andlerPersistence.java:204)
> at org.eclipse.ui.internal.handlers.HandlerPersistence.read(Han dlerPersistence.java:158)
> at org.eclipse.ui.internal.handlers.HandlerService.readRegistry (HandlerService.java:186)
> at org.eclipse.ui.internal.handlers.HandlerServiceFactory.creat e(HandlerServiceFactory.java:61)
> at org.eclipse.ui.internal.services.WorkbenchServiceRegistry.ge tService(WorkbenchServiceRegistry.java:102)
> at org.eclipse.ui.internal.services.ServiceLocator.getService(S erviceLocator.java:174)
> at org.eclipse.ui.internal.Workbench$43.runWithException(Workbe nch.java:1675)
> at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run (StartupThreading.java:31)
> at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.j ava:178)
> at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchroniz er.java:150)
> at org.eclipse.swt.widgets.Display.syncExec(Display.java:4251)
> at org.eclipse.ui.internal.StartupThreading.runWithoutException s(StartupThreading.java:94)
> at org.eclipse.ui.internal.Workbench.initializeDefaultServices( Workbench.java:1671)
> at org.eclipse.ui.internal.Workbench.init(Workbench.java:1318)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2312)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:21 98)
> at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
> at org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:288)
> at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:488)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
> at com.pikeelectronic.tibco.makedoc.gui.rcp.impl.Application.st art(Unknown Source)
> at org.eclipse.swtbot.eclipse.junit4.headless.UITestApplication .start(UITestApplication.java:53)
> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:193)
> 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(EclipseS tarter.java:382)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.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)
> 2011-02-17 21:36:45 INFO [main] [null:-1] Read license from: X:\MakeDoc\tmp\MakeDocSkeletonExported\_MakeDoc.key.1
> Application Started: 4985
>
> !ENTRY org.eclipse.equinox.p2.ui.sdk 2 0 2011-02-17 21:36:47.625
> !MESSAGE Could not locate the running profile instance
>
>
> Target class is not implementing IHandler interface, but I don't understand why it is necessary to cast when in Eclipse everything is working well.
>
> Using SWTBot 2.0.2 and Eclipse 3.4.0.
>
> Any help will be appreciated.
>
> JJ


--
Mickael Istria -- BonitaSoft S.A.
http://www.bonitasoft.com/products/BPM_download.php
Re: java.lang.ClassCastException when running SWTBot tests in headless mode [message #655125 is a reply to message #654980] Fri, 18 February 2011 12:45 Go to previous messageGo to next message
Jiri Janecek is currently offline Jiri JanecekFriend
Messages: 12
Registered: February 2011
Junior Member
Mickael thaks for your response, I performed a little investigation by the help of Osgi console with this result:

!ENTRY org.eclipse.osgi 2 0 2011-02-18 12:54:19.651
!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 2011-02-18 12:54:19.651
!MESSAGE Bundle update@plugins/org.eclipse.swtbot.ant.optional.junit4_2.0.2.20110117_1743-b492ddb-dev-e34.jar [1760] was not resolved.
!SUBENTRY 2 org.eclipse.swtbot.ant.optional.junit4 2 0 2011-02-18 12:54:19.651
!MESSAGE Constraints from the fragment conflict with the host: Require-Bundle: org.eclipse.core.runtime.compatibility; bundle-version="0.0.0"
!SUBENTRY 2 org.eclipse.swtbot.ant.optional.junit4 2 0 2011-02-18 12:54:19.651
!MESSAGE Constraints from the fragment conflict with the host: Require-Bundle: org.junit4; bundle-version="0.0.0"


When I try to switch to platform of exported rcp app with Eclipse IDE and add dependency of my test plugin to org.eclipse.swtbot.ant.optional.junit4 by adding this line to plugin's manifest

org.eclipse.swtbot.ant.optional.junit4;bundle-version="2.0.2",


I am getting

 
Unsatisfied version constraint: 'org.eclipse.swtbot.ant.optional.junit4: 2.0.2'


But I absolutly don't know why. The version included in target platform is org.eclipse.swtbot.ant.optional.junit4_2.0.2.20110117_1743-b 492ddb-dev-e34.jar

Note that org.eclipse.core.runtime.compatibility and org.junit4 are included in platform.

Interesting is that the exception from tests log (not console) looks like it has no dependency with unresolved bundles (JavaCastException in the target RCP app).

JJ

[Updated on: Fri, 18 February 2011 13:20]

Report message to a moderator

Re: java.lang.ClassCastException when running SWTBot tests in headless mode [message #655218 is a reply to message #655125] Fri, 18 February 2011 16:22 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
You might be missing the dependencies of the
org.eclipse.swtbot.ant.optional.junit4 bundle.

I've documented tricks for figuring out some such things on the wiki
page at
http://wiki.eclipse.org/SWTBot/OSGi_Console#Diagnosing_missi ng_dependencies

--
Ketan
ketan.padegaonkar.name | eclipse.org/swtbot | @ketanpkr

On 2/18/11 4:45 AM, Jiri Janecek wrote:
> Michal thaks for your response, I performed a little investigation by
> the help of Osgi console with this result:
>
>
> !ENTRY org.eclipse.osgi 2 0 2011-02-18 12:54:19.651
> !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 2011-02-18 12:54:19.651
> !MESSAGE Bundle
> update@plugins /org.eclipse.swtbot.ant.optional.junit4_2.0.2.20110117_1743- b492ddb-dev-e34.jar
> [1760] was not resolved.
> !SUBENTRY 2 org.eclipse.swtbot.ant.optional.junit4 2 0 2011-02-18
> 12:54:19.651
> !MESSAGE Constraints from the fragment conflict with the host:
> Require-Bundle: org.eclipse.core.runtime.compatibility;
> bundle-version="0.0.0"
> !SUBENTRY 2 org.eclipse.swtbot.ant.optional.junit4 2 0 2011-02-18
> 12:54:19.651
> !MESSAGE Constraints from the fragment conflict with the host:
> Require-Bundle: org.junit4; bundle-version="0.0.0"
>
>
> When I try to switch to platform of exported rcp app with Eclipse IDE
> and add dependency of my test plugin to
> org.eclipse.swtbot.ant.optional.junit4 by adding this line to plugin's
> manifest
>
>
> org.eclipse.swtbot.ant.optional.junit4;bundle-version="2.0.2 ",
>
>
> I am getting
>
>
> Unsatisfied version constraint: 'org.eclipse.swtbot.ant.optional.junit4:
> 2.0.2'
>
>
> But I absolutly don't know why. The version included in target platform
> is org.eclipse.swtbot.ant.optional.junit4_2.0.2.20110117_1743-b
> 492ddb-dev-e34.jar
>
> JJ
Re: java.lang.ClassCastException when running SWTBot tests in headless mode [message #655224 is a reply to message #654980] Fri, 18 February 2011 17:19 Go to previous messageGo to next message
Jiri Janecek is currently offline Jiri JanecekFriend
Messages: 12
Registered: February 2011
Junior Member
Hi Ketan,

thanks for reply, I tried to inspect missing dependencies. There were only missing constraints as you can read above. For this I found solution in this forum (ant optional fragment and host org.apache.ant in the same feature, thanks to Mickael Wink), so this is correct now.

My original idea was not to mix tests and app source code so this is not ideal for me. I would like to pick exported app, copy everything needed for tests and run tests. But it is still not working at the moment ...

I am actually getting could not find the plugin. When I run target RCP app, in About Dialog can see my test plugin ... Think this is the last step to get it working but don't know, what to do.

Relevat part of ant script:

<target name="suite" depends="path">
		<echo>******************************************************</echo>
    <echo>                Run GUI tests ...                     </echo>
    <echo>******************************************************</echo>	
    <property name="temp-workspace" value="workspace" />
      <delete dir="${temp-workspace}" quiet="true" />
    	<ant target="swtbot-test" antfile="${library-file}" dir="${eclipse-home}">
          <property name="data-dir" value="${temp-workspace}" />
          <property name="plugin-name" value="${plugin-name}" />
          <property name="classname" value="com.pike.panther.tests.GuiTests" />
          <property name="vmargs" value=" -Xms128M -Xmx368M -XX:MaxPermSize=256M" />
          <property name="os" value="win32"/>
          <property name="ws" value="win32"/>
          <property name="arch" value="x86"/>
          <property name="formatter" value="org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter" />
          <property name="testApplication" value="MakeDocRCP.application"/>
          <property name="product" value="MakeDocRCP"/>
      </ant>
    </target>


JJ
Re: java.lang.ClassCastException when running SWTBot tests in headless mode [message #658027 is a reply to message #654980] Sat, 05 March 2011 08:29 Go to previous messageGo to next message
Jiri Janecek is currently offline Jiri JanecekFriend
Messages: 12
Registered: February 2011
Junior Member
After some time I returned to GUI testing with SWTBot. I played with many scenarios to determine conditions when everything is working well.

Tested product includes one feature which contains custom plugins. As I said I wouldn;t like to mix tests and product code, so I created tests feature and added this feature as optional to feature which forms product. This feature is built separately from main build process.

Thanks to Mickael I know that it is necessary to have host org.apache.ant and fragment org.eclipse.swtbot.ant.optional.junit4 (together with org.junit4) in the same feature. But it seems that tests are working well if this plugins are included in original feature only. If not I am getting this:

ENTRY org.eclipse.osgi 2 0 2011-02-18 12:54:19.651
!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 2011-02-18 12:54:19.651
!MESSAGE Bundle update@plugins/org.eclipse.swtbot.ant.optional.junit4_2.0.2.20110117_1743-b492ddb-dev-e34.jar [1760] was not resolved.
!SUBENTRY 2 org.eclipse.swtbot.ant.optional.junit4 2 0 2011-02-18 12:54:19.651
!MESSAGE Constraints from the fragment conflict with the host: Require-Bundle: org.eclipse.core.runtime.compatibility; bundle-version="0.0.0"
!SUBENTRY 2 org.eclipse.swtbot.ant.optional.junit4 2 0 2011-02-18 12:54:19.651
!MESSAGE Constraints from the fragment conflict with the host: Require-Bundle: org.junit4; bundle-version="0.0.0"



If I manage to have everything in the test feature, tests become completely hidden from developers and they will not need to add swtbot bundles in their platforms.

Is there any way how to achieve this?

Thanks for your time.

JJ

Re: java.lang.ClassCastException when running SWTBot tests in headless mode [message #658054 is a reply to message #658027] Sat, 05 March 2011 16:37 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
On 3/5/11 12:29 AM, Jiri Janecek wrote:
> After some time I returned to GUI testing with SWTBot. I played with
> many scenarios to determine conditions when everything is working well.
>
> Tested product includes one feature which contains custom plugins. As I
> said I wouldn;t like to mix tests and product code, so I created tests
> feature and added this feature as optional to feature which forms
> product. This feature is built separately from main build process.

+1 so far. We have 2 product files, one for production(without test
features) and one with the test features and dependencies.

The only difference is that we build the production product after the
test product is built, which means that if the tests break, the
production build is never generated forcing devs to fix the problem as
soon as it is detected.

<snipped/>

> If I manage to have everything in the test feature, tests become
> completely hidden from developers and they will not need to add swtbot
> bundles in their platforms.
>
> Is there any way how to achieve this?

[Putting my consultant hat on...]

This is unfortunately a people problem, and tools might be a bad idea to
solve them, to the point that people will start hating the tool.

I feel the correct way to address this issue would be to find out why
devs want to hide away the test bundles and encourage them to write very
simple tests to document the feature they are working on. These need not
cover any corner cases, but just go through some happy paths to ensure
that basic functionality works before checking in code.

A set of a handful of such smoke tests that run in under 2-3 minutes to
test basic features of the application to ensure that nothing obvious
has been broken before someone checks in can prove to be very valuable
to developers.

--
Ketan
http://ketan.padegaonkar.name | http://eclipse.org/swtbot | @ketanpkr
Re: java.lang.ClassCastException when running SWTBot tests in headless mode [message #658097 is a reply to message #654980] Sun, 06 March 2011 11:30 Go to previous messageGo to next message
Jiri Janecek is currently offline Jiri JanecekFriend
Messages: 12
Registered: February 2011
Junior Member
Ok, understand. In the final phase I discovered one more problem. SWTBot tests are running on Hudson slave. Application is correctly started but will never get focus.

(this is not happening when I run test script manually from command line directly on hudson slave)

Thanks to this I am not able to use Autoit to bypass work with native dialogs.

It is working only if I add some sleep to test and after start manually click into app window but this is not acceptable in case of test automation.

Is there any workaround for this?

EDIT: Note that cursor is in the vm when application is starting
EDIT2: It seems that everything is working if cmd which runs slave has focus, interesting maybe it will help smb.
JJ

[Updated on: Sun, 06 March 2011 12:56]

Report message to a moderator

Re: java.lang.ClassCastException when running SWTBot tests in headless mode [message #658161 is a reply to message #658097] Mon, 07 March 2011 08:28 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

If you are on Linux, a workaround is to start another X server dedicated to SWTBot tests, and to start instances of your app with SWTBot tests in this X server.

HTH

Le 06/03/2011 12:30, Jiri Janecek a écrit :
> Ok, understand. In the final phase I discovered one more problem. SWTBot tests are running on Hudson slave. Application is correctly started but will never get focus.
>
> Thanks to this I am not able to use Autoit to bypass work with native dialogs.
>
> It is working only if I add some sleep to test and after start manually click into app window but this is not acceptable in case of test automation.
>
> Is there any workaround for this?
>
> JJ


--
Mickael Istria -- BonitaSoft S.A.
http://www.bonitasoft.com/products/BPM_download.php
Re: java.lang.ClassCastException when running SWTBot tests in headless mode [message #658162 is a reply to message #658027] Mon, 07 March 2011 08:31 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

Do you also have the org.eclipse.core.runtime.compatibility bundle in your feature?

Le 05/03/2011 09:29, Jiri Janecek a écrit :
> After some time I returned to GUI testing with SWTBot. I played with many scenarios to determine conditions when everything is working well.
>
> Tested product includes one feature which contains custom plugins. As I said I wouldn;t like to mix tests and product code, so I created tests feature and added this feature as optional to feature which forms product. This feature is built separately from main build process.
>
> Thanks to Mickael I know that it is necessary to have host org.apache.ant and fragment org.eclipse.swtbot.ant.optional.junit4 (together with org.junit4) in the same feature. But it seems that tests are working well if this plugins are included in original feature only. If not I am getting this:
>
>
> ENTRY org.eclipse.osgi 2 0 2011-02-18 12:54:19.651
> !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 2011-02-18 12:54:19.651
> !MESSAGE Bundle update@plugins /org.eclipse.swtbot.ant.optional.junit4_2.0.2.20110117_1743- b492ddb-dev-e34.jar [1760] was not resolved.
> !SUBENTRY 2 org.eclipse.swtbot.ant.optional.junit4 2 0 2011-02-18 12:54:19.651
> !MESSAGE Constraints from the fragment conflict with the host: Require-Bundle: org.eclipse.core.runtime.compatibility; bundle-version="0.0.0"
> !SUBENTRY 2 org.eclipse.swtbot.ant.optional.junit4 2 0 2011-02-18 12:54:19.651
> !MESSAGE Constraints from the fragment conflict with the host: Require-Bundle: org.junit4; bundle-version="0.0.0"
>
>
>
> If I manage to have everything in the test feature, tests become completely hidden from developers and they will not need to add swtbot bundles in their platforms.
>
> Is there any way how to achieve this?
>
> Thanks for your time.
>
> JJ
>
>


--
Mickael Istria -- BonitaSoft S.A.
http://www.bonitasoft.com/products/BPM_download.php
Re: java.lang.ClassCastException when running SWTBot tests in headless mode [message #658189 is a reply to message #654980] Mon, 07 March 2011 10:42 Go to previous message
Jiri Janecek is currently offline Jiri JanecekFriend
Messages: 12
Registered: February 2011
Junior Member
It is WXP machine Sad

Now I haven't complatibility plugin in my feature but tests are working. It is interesting but all is working if fragment and host are in the feature which forms our product. When I move tests and its deps to optional tests feature which is included in main feature it stops working. Now i am trying to create one more product and feature which is copy of main feature + tests and deps as Ketan said.

JJ

[Updated on: Mon, 07 March 2011 10:58]

Report message to a moderator

Previous Topic:swtbot find hyperlink
Next Topic:No "Run As - SwtBot Test" available after installation
Goto Forum:
  


Current Time: Fri Apr 26 22:15:53 GMT 2024

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

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

Back to the top