Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Junit plugin testing class loading problem.
Junit plugin testing class loading problem. [message #435423] Wed, 17 August 2005 20:08 Go to next message
Cedric Hyppolite is currently offline Cedric HyppoliteFriend
Messages: 22
Registered: July 2009
Junior Member
Hi,

I have been trying to run some plugin test and failed with a class not
found error.

First, I have found almost no documentation on the 'run as Junit plugin
test' feature. If anyone know where this is documented please let me know.

I have found a statement saying that to run a plugin test in a RCP
application, a testrunner must be written. I don't understand where this
test runner should be added.

In my setup, the test plugin is separated from the code plugin. The
application class is in another plugin.

All of them depends on org.junit and org.eclipse.pde.junit.runtime. All
plugin are loaded. My RCP application is the one launched.

If any of you have a working setup with junit tests, testsuite and runs
all the stuff together with the RCP application please describe the
setup used.

The test I am trying to run used ResourcePlugin.getWorkspace()
thereforce cannot be run without the "Run plugin test" command.

Thanks for your time,
Cedric

Here is the stack trace of the crash.

Class not found org.network.platform.info.TestInfoFactory
java.lang.ClassNotFoundException: org.network.platform.info.TestInfoFactory
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:403)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:350)
at
org.eclipse.osgi.framework.adaptor.core.AbstractClassLoader. loadClass(AbstractClassLoader.java:78)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.loadCl ass(BundleLoader.java:275)
at
org.eclipse.osgi.framework.internal.core.BundleHost.loadClas s(BundleHost.java:227)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.load Class(AbstractBundle.java:1259)
at
org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunne r$BundleClassLoader.findClass(RemotePluginTestRunner.java:35 )
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadS uiteClass(RemoteTestRunner.java:428)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.getTe st(RemoteTestRunner.java:380)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:445)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:344)
at
org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunne r.main(RemotePluginTestRunner.java:57)
at
org.eclipse.pde.internal.junit.runtime.UITestApplication$1.r un(UITestApplication.java:99)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:123)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:2932)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2708)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1699)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:367)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:143)
at org.network.framework.networkApplication.run(networkApplicat ion.java:30)
at
org.eclipse.pde.internal.junit.runtime.UITestApplication.run (UITestApplication.java:39)
at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:226)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:376)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:163)
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:324)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334 )
at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
at org.eclipse.core.launcher.Main.run(Main.java:973)
at org.eclipse.core.launcher.Main.main(Main.java:948)
Re: Junit plugin testing class loading problem. [message #435814 is a reply to message #435423] Wed, 24 August 2005 10:42 Go to previous messageGo to next message
Chris Senior is currently offline Chris SeniorFriend
Messages: 6
Registered: July 2009
Junior Member
I have had the same kind of exception being raised (ClassNotFoundEx) where
the reported class is my TestCase.

However after stepping through lots of complex Eclipse class loader code I
found that the plugin it was dependent on (the one who's functions I was
testing) was not loading correctly. The plugin class (BundleActivator)
start() method was crashing with a dumb NullPointerEx.

What I found irritating was that this exception (the real one) was never
reported!? Rather Eclipse failed to start my plugin and then failed to
load any classes from that plugin.

This caused my test case not to be loaded because it's dependent classes
were not correctly loaded.

Normally stuff like this would get written to the log files. However in
headless JUnit test mode I can't find the logs (the workspace mentioned in
the launch does not exist). Are there any? If so where?

Maybe you have a similar problem?

- Chris
Re: Junit plugin testing class loading problem. [message #435945 is a reply to message #435814] Thu, 25 August 2005 17:36 Go to previous messageGo to next message
Cedric Hyppolite is currently offline Cedric HyppoliteFriend
Messages: 22
Registered: July 2009
Junior Member
Chris,

Thanks a lot for the tip. I will try to look into this direction.

Cedric

Chris Senior wrote:
> I have had the same kind of exception being raised (ClassNotFoundEx)
> where the reported class is my TestCase.
> However after stepping through lots of complex Eclipse class loader code
> I found that the plugin it was dependent on (the one who's functions I
> was testing) was not loading correctly. The plugin class
> (BundleActivator) start() method was crashing with a dumb NullPointerEx.
>
> What I found irritating was that this exception (the real one) was never
> reported!? Rather Eclipse failed to start my plugin and then failed to
> load any classes from that plugin.
> This caused my test case not to be loaded because it's dependent classes
> were not correctly loaded.
>
> Normally stuff like this would get written to the log files. However in
> headless JUnit test mode I can't find the logs (the workspace mentioned
> in the launch does not exist). Are there any? If so where?
>
> Maybe you have a similar problem?
>
> - Chris
>
Re: Junit plugin testing class loading problem. [message #435948 is a reply to message #435814] Thu, 25 August 2005 19:29 Go to previous message
Cedric Hyppolite is currently offline Cedric HyppoliteFriend
Messages: 22
Registered: July 2009
Junior Member
The problem was indeed related to the failure to load the plugin.

I renamed the package containing my test using the refactor command.
But the refactor did not update the plugin.xml file. This was prevent
the test plugin to load and generating the exception.

The fact that the refactoring does not update the plugin.xml is already
entered as a bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=72296

Thanks Chris for the suggestion.

Best regards,

Cedric

Chris Senior wrote:

> I have had the same kind of exception being raised (ClassNotFoundEx)
> where the reported class is my TestCase.
> However after stepping through lots of complex Eclipse class loader code
> I found that the plugin it was dependent on (the one who's functions I
> was testing) was not loading correctly. The plugin class
> (BundleActivator) start() method was crashing with a dumb NullPointerEx.
>
> What I found irritating was that this exception (the real one) was never
> reported!? Rather Eclipse failed to start my plugin and then failed to
> load any classes from that plugin.
> This caused my test case not to be loaded because it's dependent classes
> were not correctly loaded.
>
> Normally stuff like this would get written to the log files. However in
> headless JUnit test mode I can't find the logs (the workspace mentioned
> in the launch does not exist). Are there any? If so where?
>
> Maybe you have a similar problem?
>
> - Chris
>
Previous Topic:Launching Help from Toolbar Action
Next Topic:Design an RCP application
Goto Forum:
  


Current Time: Sat Dec 14 17:46:11 GMT 2024

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

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

Back to the top