Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » How to use latest Junit with Eclipse ganymede?
How to use latest Junit with Eclipse ganymede? [message #554924] Tue, 24 August 2010 18:32 Go to next message
Steven Chamberlin is currently offline Steven Chamberlin
Messages: 30
Registered: July 2009
Member
Sorry this isn't exactly related to SWT-Bot but has to do with my test environment (which I'm using to write SWT-Bot tests), and I know the people on this forum can be very helpful.

I am on Eclipse ganymede 3.4.2, which includes Junit 4.3. I noticed that the new version of Junit, as of 4.8. supports categories. Details here:

http://kentbeck.github.com/junit/doc/ReleaseNotes4.8.html

I was able to add the @Category notations by importing the junit 4.8.2 jars into a new plugin in my workspace and putting that plugin as a dependency of my test plugin. Doing so, I was able to get it to compile; however when I try to actually execute the tests, I get the following error at runtime: junit.framework.AssertionFailedError: No tests found in com.ibm.datatools.swtbot.tests.ods.BVTTestsODS, even though my tests are clearly marked with @Test annotation.

I'm not sure if I'm on the right track here. I found this post here:

http://www.coderanch.com/t/483119/Testing/run-JUnit-test-Ecl ipse

This guy was trying to do kind of a similar thing, with a similar error, and to fix it he finally ended up just upgrading his entire Eclipse. I'm hoping I won't have to do that, since we need to stay on this version of Eclipse because the product I'm testing is based off of this version. (Or could I use a different version of Eclipse for my testcase development as the 'target platform'? I don't think so right?).

Does anyone know how I can upgrade the version of Junit in Eclipse to Junit 4.8+ ?

Thanks in advance,

Steve
Re: How to use latest Junit with Eclipse ganymede? [message #555407 is a reply to message #554924] Thu, 26 August 2010 13:42 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan Padegaonkar
Messages: 873
Registered: July 2009
Senior Member
On 8/24/10 11:32 AM, Steven Chamberlin wrote:

> Does anyone know how I can upgrade the version of Junit in Eclipse to
> Junit 4.8+ ?

AFAIK, you cannot :( There are quite a few eclipse plugins in 3.4 that
are scoped to junit v4.3-v4.4. Almost anything outside this range will
break those plugins. Here's something that I think *might* solve your
problem. But involves getting your hands way too dirty and doing a lot
of evil. Here's something that I think *might* help. Your mileage may vary.

- overwrite the junit.jar and MANIFEST.MF inside the junit4 plugin in
eclipse 3.4 with the corresponding plugin from eclipse 3.6. If you're
getting this from the junit site, ensure that you download the 'slim'
junit jar with no dependencies.

- Change the version numbers of junit from 4.8.1 to 4.3.1 in the new
MANIFEST.MF in the junit plugin.

- Remove all SHA1 digest lines in the MANIFEST.MF file of the junit 4
plugin.

- Remove all the files (except MANIFEST.MF) from the META-INF directory
of the junit 4 plugin.

- Replace the 'org.eclipse.swtbot.junit4_x' jar for eclipse 3.4 with the
one from eclipse 3.6 -- it depends on the junit internals.

- Unpack the new 'org.eclipse.swtbot.junit4_x' jar and do the steps
similar to the junit jar (change version number in manifest), and remove
the eclipse* files.

- Pack the org.eclipse.swtbot.junit4_x folder back into the jar.

Let me know if these steps work for you. I'd be glad to publish the jars
somewhere for people to download directly :)

--
Ketan
http://ketan.padegaonkar.name | http://eclipse.org/swtbot
Re: How to use latest Junit with Eclipse ganymede? [message #555724 is a reply to message #555407] Fri, 27 August 2010 21:20 Go to previous messageGo to next message
Steven Chamberlin is currently offline Steven Chamberlin
Messages: 30
Registered: July 2009
Member
Ketan,

Thanks very much for the detailed reply. Unfortunately, what I'm looking for is a test categorization strategy that we can deploy across our department (30+ testers), so I don't want to rely on a set of manual hacking steps that may have unintended consequences. I appreciate the suggestion though and the time you took to type that up.

Wondering if you or anyone knows of a workaround to get categorization technique with Junit 4.3. I guess we will fall back on naming convention / suites, but the problem is that as far as I know, suites cannot include testcases individually but only whole classes at a time. This might mean breaking up testcases into multiple classes so that they have finer granularity to put into the suites.

-- Steve
Re: How to use latest Junit with Eclipse ganymede? [message #635455 is a reply to message #555724] Tue, 26 October 2010 21:18 Go to previous message
Robert Sullivan is currently offline Robert Sullivan
Messages: 1
Registered: October 2010
Junior Member
I think Ketan was talking about changing the JUnit that eclipse itself is reliant on, but there's no reason you can't use a different version for your own projects. I saw one post about tossing it into the eclipse 'dropins' folder, which I've never heard of, but typically the way to do this is create a Lib folder in your project and put the version of JUnit 4.8.x or whatever you want to use there. This is what I am doing and it works for my purposes.

dropins folder:
http://github.com/KINFOO/LuaEclipse/wiki/set-up-the-developm ent-environment

You would think there would be some way to do this via the Software Updates, since JUnit is such a fundamental library. From a brief reading, the way JUnit is integrated in with eclipse has changed with "Helios", so it seems this will soon change..
Previous Topic:Help: Could not find plugin
Next Topic:SWTBot tests using Jython
Goto Forum:
  


Current Time: Wed Oct 22 23:05:50 GMT 2014

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

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