Ray Wu
Ray Wu

Reputation: 1033

using SWTBot but always encounter [Exception in thread "WorkbenchTestable" java.lang.IllegalArgumentException: No Classloader found for plug-in X]

I'm using SWTBot 2.1.1 in Eclipse 4.2.2 Juno on Mac OS X 10.8.4.

There are some tutorials (1, 2) online, but no matter how many times I tried, I always encounter

!ENTRY org.eclipse.core.net 1 0 2013-07-17 17:33:52.328
!MESSAGE System property http.nonProxyHosts has been set to local|*.local|169.254/16|*.169.254/16 by an external source. This value will be overwritten using the values from the preferences
Exception in thread "WorkbenchTestable" java.lang.IllegalArgumentException: No Classloader found for plug-in com.eclipse.swtbot.setup
at org.eclipse.swtbot.eclipse.core.RemotePluginTestRunner.getClassLoader(RemotePluginTestRunner.java:79)
at org.eclipse.swtbot.eclipse.core.RemotePluginTestRunner.getTestClassLoader(RemotePluginTestRunner.java:73)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(RemoteTestRunner.java:693)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClasses(RemoteTestRunner.java:429)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.swtbot.eclipse.core.RemotePluginTestRunner.main(RemotePluginTestRunner.java:64)
at org.eclipse.swtbot.eclipse.core.UITestApplication.runTests(UITestApplication.java:117)
at org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(WorkbenchTestable.java:71)
at java.lang.Thread.run(Thread.java:680)

Everytime I run this SWTBot test, it will only bring up an empty Eclipse window and nothing more.

Someone points out that I should add the current bundle in Run -> Run Configuration ... -> SWTBot Test -> Plug-ins, but even if I add all plug-in in there, the error still exist.

Any help?

Upvotes: 1

Views: 964

Answers (2)

Eppman
Eppman

Reputation: 50

I had the same issue. For me there was the bundle which contains my swtbot test not launched because I did not selected it in the run Configuration. Here are the steps you should check which worked for me:

  1. Run -> Run Configurations… -> your SWTBot Test -> Plug-ins

  2. Launch with: plug-ins selected below only

  3. Select all plug-ins from Workspace you need to run your application + your plug-in that contains the SWTBot test

  4. now click on Add Required Plug-ins for two times to ensure all needed plug-ins are selected from Target Platform

  5. ensure you have the minimum of Plug-ins selected needed by the SWTBot. These are: org.eclipse.swtbot.eclipse.core, org.eclipse.swtbot.eclipse.finder, org.eclipse.swtbot.junit4_x, org.eclipse.swtbot.swt.finder

  6. click Validate Plug-ins and add all Plug-ins manually that are mentioned there
  7. click Apply and Run

Upvotes: 1

GGomes
GGomes

Reputation: 21

In launch configurations -> plug-ins, do you have the "launch with" combobox set with "all workspace and enabled target plug-ins"?

I struggled with same issue and figured out this was (part of) the problem.

Upvotes: 1

Related Questions