Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » JUnit version used by testing support?
JUnit version used by testing support? [message #1042214] Tue, 16 April 2013 02:01 Go to next message
Jeremie Bresson is currently offline Jeremie Bresson
Messages: 668
Registered: October 2011
Senior Member
I am facing problems writing tests using @BeforeClass and @AfterClass.

I get following stacktrace:
java.lang.NoClassDefFoundError: org/junit/internal/runners/model/MultipleFailureException
	at org.eclipse.scout.testing.client.runner.ScoutClientTestRunner.withAfterClasses(ScoutClientTestRunner.java:153)
	at org.junit.runners.ParentRunner.classBlock(ParentRunner.java:145)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:235)
	at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
	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.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
	at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
	at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:123)
	at org.eclipse.tycho.surefire.osgibooter.OsgiSurefireBooter.run(OsgiSurefireBooter.java:85)
	at org.eclipse.tycho.surefire.osgibooter.HeadlessTestApplication.run(HeadlessTestApplication.java:21)
	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.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:587)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:198)
	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:369)
	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:620)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1384)
Caused by: java.lang.ClassNotFoundException: org.junit.internal.runners.model.MultipleFailureException
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
	... 34 more


In my workspace I have this class in the junit.jar (located in the org.junit.source_4.8.2.v4_8_2_v20110321-1705 plugin).

I tried to add the package to the MANIFEST.MF
org.junit.internal.runners.model;version="4.8.2"


But this is not understood by the maven build. I get the error: "No solution found because the problem is unsatisfiable.".

Quick search in Google:
http://mavenhub.com/c/org/junit/runners/model/multiplefailureexception

In a plain maven project, I should have a dependency declared in the POM:
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.9</version>
      </dependency>


I tried to update my Manifest:
org.junit.internal.runners.model;version="[4.9.0,5.0.0)"


But I still get the "no solution problem" (is this because of Tycho ?):
[ERROR] Internal error: java.lang.RuntimeException: "No solution found because the problem is unsatisfiable.": ["Unable to satisfy dependency from org.eclipse.scout.rt.testing.client.test 3.9.0.qualifier to package org.junit [4.9.0,5.0.0).", "Unable to satisfy dependency from org.eclipse.scout.rt.testing.client.test 3.9.0.qualifier to package org.junit.runner [4.9.0,5.0.0).", "Unable to satisfy de
pendency from org.eclipse.scout.rt.testing.client.test 3.9.0.qualifier to package org.junit.runners.model [4.9.0,5.0.0).", "No solution found because the problem is unsatisfiable."] -> [Help 1]
org.apache.maven.InternalErrorException: Internal error: java.lang.RuntimeException: "No solution found because the problem is unsatisfiable.": ["Unable to satisfy dependency from org.eclipse.scout.rt.testing.client.test 3.9.0.qualifier to package org.junit [4.9.0,5.0.0).", "Unable to satisfy dependency from org.eclipse.scout.rt.testing.client.test 3.9.0.qualifier to package org.junit.runner [4.9.
0,5.0.0).", "Unable to satisfy dependency from org.eclipse.scout.rt.testing.client.test 3.9.0.qualifier to package org.junit.runners.model [4.9.0,5.0.0).", "No solution found because the problem is unsatisfiable."]
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:168)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        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.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: java.lang.RuntimeException: "No solution found because the problem is unsatisfiable.": ["Unable to satisfy dependency from org.eclipse.scout.rt.testing.client.test 3.9.0.qualifier to package org.junit [4.9.0,5.0.0).", "Unable to satisfy dependency from org.eclipse.scout.rt.testing.client.test 3.9.0.qualifier to package org.junit.runner [4.9.0,5.0.0).", "Unable to satisfy dependency from
 org.eclipse.scout.rt.testing.client.test 3.9.0.qualifier to package org.junit.runners.model [4.9.0,5.0.0).", "No solution found because the problem is unsatisfiable."]
        at org.eclipse.tycho.p2.resolver.AbstractResolutionStrategy.newResolutionException(AbstractResolutionStrategy.java:81)
        at org.eclipse.tycho.p2.resolver.ProjectorResolutionStrategy.resolve(ProjectorResolutionStrategy.java:88)
        at org.eclipse.tycho.p2.resolver.AbstractResolutionStrategy.resolve(AbstractResolutionStrategy.java:58)
        at org.eclipse.tycho.p2.impl.resolver.P2ResolverImpl.resolveDependencies(P2ResolverImpl.java:122)
        at org.eclipse.tycho.p2.impl.resolver.P2ResolverImpl.resolveDependencies(P2ResolverImpl.java:78)
        at org.eclipse.tycho.p2.resolver.P2TargetPlatformResolver.doResolvePlatform(P2TargetPlatformResolver.java:373)
        at org.eclipse.tycho.p2.resolver.P2TargetPlatformResolver.resolveDependencies(P2TargetPlatformResolver.java:350)
        at org.eclipse.tycho.core.resolver.DefaultTychoDependencyResolver.resolveProject(DefaultTychoDependencyResolver.java:109)
        at org.eclipse.tycho.core.maven.TychoMavenLifecycleParticipant.afterProjectsRead(TychoMavenLifecycleParticipant.java:82)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:274)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        ... 11 more


Sidenote:
It seems that with version 4.9, org.junit.internal.runners.model.MultipleFailureException has been depreciated and move to org.junit.runners.model.MultipleFailureException (see Javadoc: MultipleFailureException)



Re: JUnit version used by testing support? [message #1042761 is a reply to message #1042214] Tue, 16 April 2013 17:03 Go to previous messageGo to next message
Stephan Leicht Vogt is currently offline Stephan Leicht Vogt
Messages: 102
Registered: February 2010
Location: Baden Switzerland
Senior Member

Hi Jérémie

I can recreate your problem but unfortunately I don't have an idea how to solve this. I think the problem is, that the internal packages of junit are hidden on osgi-level in the org.junit 4.8.1.v4_8_1_v20100427-1100 bundle:

org.junit.internal.runners.model;version="4.8.1";x-internal:=true


I'm looking further into it and will keep you uptodate.

Greetings Stephan
Re: JUnit version used by testing support? [message #1042989 is a reply to message #1042761] Wed, 17 April 2013 02:01 Go to previous messageGo to next message
Stephan Leicht Vogt is currently offline Stephan Leicht Vogt
Messages: 102
Registered: February 2010
Location: Baden Switzerland
Senior Member

As junit 4.11 is already on orbit I would like to switch to 4.11 for eclipse scout. Any objection? https://bugs.eclipse.org/bugs/show_bug.cgi?id=405846
Re: JUnit version used by testing support? [message #1043008 is a reply to message #1042989] Wed, 17 April 2013 02:39 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie Bresson
Messages: 117
Registered: November 2010
Senior Member
Seems good to me.
Re: JUnit version used by testing support? [message #1044572 is a reply to message #1043008] Fri, 19 April 2013 00:33 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie Bresson
Messages: 668
Registered: October 2011
Senior Member
[ERROR] Internal error: java.lang.RuntimeException: "No solution found because the problem is unsatisfiable.": ["Unable to satisfy dependency from org.eclipse.scout.rt.testing.client.test 3.9.0.qualifier to package org.junit [4.9.0,5.0.0).", "Unable to satisfy dependency from org.eclipse.scout.rt.testing.client.test 3.9.0.qualifier to package org.junit.runner [4.9.0,5.0.0).", "Unable to satisfy de pendency from org.eclipse.scout.rt.testing.client.test 3.9.0.qualifier to package org.junit.runners.model [4.9.0,5.0.0).", "No solution found because the problem is unsatisfiable."] -> [Help 1]


Here some additional inputs (follow also the discussion on the bug):

Quote:
> * If you are in a maven/tycho build, how do you control the JUnit version? It
> should be a maven/tycho configuration not? (I had the feeling that tycho was
> deducing the JUnit version using the version indicated in the Manifest).
It does deduce the junit version from your manifest files and uses the one available from the target-platform-configuration configuration.


If you want to get a newer version of JUnit in your target platform, you can get it from Orbit, by adding this code to your target file:
    <location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
      <unit id="org.junit" version="4.10.0.v4_10_0_v20120426-0900"/>

      <repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20130118183705/repository/"/>
    </location>


But it does not solve everything... org.eclipse.scout.rt.testing.shared.runner.AbstractRunAftersInSeparateScoutSession needs to be changed

[Updated on: Fri, 19 April 2013 02:12]

Report message to a moderator

Re: JUnit version used by testing support? [message #1046565 is a reply to message #1044572] Mon, 22 April 2013 00:34 Go to previous message
Jeremie Bresson is currently offline Jeremie Bresson
Messages: 668
Registered: October 2011
Senior Member
We have changed the JUnit version with Bug 405846. It should be OK with M7.
Previous Topic:scout sources checkout - problem with RWT.HYPERLINK
Next Topic:different icons in outline tree
Goto Forum:
  


Current Time: Wed Aug 27 21:28:55 EDT 2014

Powered by FUDForum. Page generated in 0.01749 seconds