Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cross-project-issues-dev] build failures with eclipse 3.6M4


Just to be clear about what is happening here: the test *framework* is getting bound to JUnit4, and your test bundles are being bound to JUnit3 as specified in your bundle manifest. When the test framework attempts to reference your tests it gets a ClassCastException because it is using a different set of classes from your test bundle. Although just running with JUnit4 is the easiest solution in most cases, you can run with JUnit3 if you follow one of the three options outlined on the wiki page (run with JDK 1.4, use an older version of the test framework, or remove JUnit4 from the system where JUnit4 is being executed).

Given that JUnit3 was superceded by JUnit4 over three years ago, and they are mostly compatible, it's probably best to just migrate to using JUnit4. The only reason I know of to remain on JUnit3 is if you want to test using JDK 1.4, and if you do run the test framework with JDK 1.4 that should continue to work with the new test framework.

Hope that helps,
John




Laurent Goubet <laurent.goubet@xxxxxxx>
Sent by: cross-project-issues-dev-bounces@xxxxxxxxxxx

12/15/2009 07:42 AM

Please respond to
laurent.goubet@xxxxxxx; Please respond to
Cross project issues <cross-project-issues-dev@xxxxxxxxxxx>

To
Cross project issues <cross-project-issues-dev@xxxxxxxxxxx>
cc
Subject
Re: [cross-project-issues-dev] build failures with eclipse 3.6M4





Hi Kim,

That I knew, but it doesn't explain why the version range [3.8.1,4.0.0)
makes eclipse fail to resolve JUnit 3.8.1 and instead trying to run my
tests with JUnit 4.7.0 (or at least, that's the behaviour that seems to
be induced by this version range). On the contrary,
http://wiki.eclipse.org/Eclipse/Testing/JUnit4_Changes#Remaining_on_JUnit3
tells us to "restrict their org.junit version range to exclude JUnit
4.0.0". That's what I did with org.junit;bundle-version="[3.8.1,4.0.0)".
On the contrary, having this version range set is the very reason that
makes my test fail in M4, and that doesn't seem like the expected behavior.

Laurent Goubet
Obeo

Kim Moir wrote:
>
> Laurent, the eclipse test framework was changed to support JUnit 4 in
> 3.6M4.  This was announced to the cross project list
>
> See
> http://dev.eclipse.org/mhonarc/lists/mdt.dev/msg00462.html
>
> and
> _
> __http://wiki.eclipse.org/Eclipse/Testing/JUnit4_Changes_
>
> Kim
>
>
>
>
> *Laurent Goubet <laurent.goubet@xxxxxxx>*
> Sent by: cross-project-issues-dev-bounces@xxxxxxxxxxx
>
> 12/15/2009 06:22 AM
> Please respond to
> laurent.goubet@xxxxxxx; Please respond to
> Cross project issues <cross-project-issues-dev@xxxxxxxxxxx>
>
>
>                  
> To
>                  cross-project-issues-dev@xxxxxxxxxxx
> cc
>                  
> Subject
>                  [cross-project-issues-dev] build failures with eclipse 3.6M4
>
>
>
>                  
>
>
>
>
>
> Hi all,
>
>
> We just built EMF Compare 1.1.0M4 today after a good dozen failing build
> : when selecting eclipse SDK 3.6M4 as a build dependency, tests simply
> refused to launch with the (abbreviated) stack trace :
>
> junit.framework.TestSuite| | at
> org.eclipse.test.EclipseTestRunner.getTest(EclipseTestRunner.java:261)
> at org.eclipse.test.EclipseTestRunner.<init>(EclipseTestRunner.java:216)
> at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.java:200)
> at
> org.eclipse.test.CoreTestApplication.runTests(CoreTestApplication.java:35)
> at org.eclipse.test.CoreTestApplication.run(CoreTestApplication.java:31)
>
> yes, basically, no information.
>
> I downloaded the M4 build along with my other dependencies, checked out
> the code of my plugins, tried to launch the tests.... and it failed with
> a stack trace :
>
> java.lang.ClassCastException: junit.framework.TestSuite cannot be cast
> to junit.framework.Test
>    at
> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.getTest(JUnit3TestLoader.java:108)
>    at
> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.loadTests(JUnit3TestLoader.java:59)
>    at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
>
> yup, that's better. Now I know that Eclipse is trying to launch my tests
> with JUnit 4 instead of JUnit 3. Why? My MANIFEST.MF clearly states :
> org.junit;bundle-version="[3.8.1,4.0.0)" which should rule out JUnit4 of
> my class path; moreover, I clearly stated "JUnit 3" in the launch config
> as the "Test Runner". Using Eclipse 3.6M3, it simply works. If I remove
> the version restrictions on JUnit from the manifest, Eclipse understands
> that my tests need be run with JUnit 3 and "it works". Is that a
> regression of M4 ? Should we avoid version restrictions in the manifest?
> have I missed a bugzilla that explained my issue?
>
> Anyway, if anyone has problems running his unit tests with the M4 build,
> remove all version restrictions from your MANIFEST.MF and you should be
> set, at least it worked for me ;).
>
> Laurent Goubet
> Obeo
> _______________________________________________
> cross-project-issues-dev mailing list
> cross-project-issues-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cross-project-issues-dev
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> cross-project-issues-dev mailing list
> cross-project-issues-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cross-project-issues-dev
>  

_______________________________________________
cross-project-issues-dev mailing list
cross-project-issues-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cross-project-issues-dev

Attachment: laurent_goubet.vcf
Description: Binary data


Back to the top