Bug 285894 - [JUnit] Run JUnit tests in parallel
Summary: [JUnit] Run JUnit tests in parallel
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P5 enhancement with 5 votes (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 272418
Blocks:
  Show dependency tree
 
Reported: 2009-08-06 11:17 EDT by Jochen Kapaun CLA
Modified: 2011-07-21 04:42 EDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jochen Kapaun CLA 2009-08-06 11:17:56 EDT
Hi!

This feature request is probably not where it should be but it was the best match i could come up with when looking at https://bugs.eclipse.org/bugs/enter_feature.cgi. Please reassign it to where it fits best.

I would like the Junit runner which is included in the Eclipse gui to be able to run multiple Junit testcases and/or test classes in parallel.

As of Junit 4.7, running tests in parallel works very nicely if you use something like this in your code: 
Result result = JUnitCore.runClasses(ParallelComputer.classes(),
				ATest.class, BTest.class);
or
Result result = JUnitCore.runClasses(ParallelComputer.methods(),
				ATest.class, BTest.class);

I would like to have the same feature available through the Junit Eclipse gui.

The immediate benefit for all Junit users in Eclipse would be huge gains in test run time.

The user would have the possibility to run the tests the normal way or in parallel. Running the tests in parallel will enforce encapsulation of individual testcases and result in shorter total test duration.

Kind regards,
Jochen
Comment 1 Prakash Rangaraj CLA 2009-08-06 12:45:59 EDT
Probably JDT owns JUnit launchers?
Comment 2 Chris Aniszczyk CLA 2009-08-07 15:21:38 EDT
This depends on JUnit 4.7 shipping with Eclipse (see bug 272418)
Comment 3 Chris Aniszczyk CLA 2009-08-07 15:22:12 EDT
Jochen, if you could provide a patch that would be great too :)
Comment 4 Dani Megert CLA 2009-10-14 05:03:02 EDT
>This depends on JUnit 4.7 shipping with Eclipse (see bug 272418)
I don't think so.
Comment 5 Markus Keller CLA 2009-10-14 05:36:37 EDT
ParallelComputer is in an experimental package, is undocumented, and its superclass explicitly tells that it's not considered stable code. Furthermore, running tests in parallel without any constraints is just doomed to fail.

We have no plans to support this at the moment.
Comment 6 Dani Megert CLA 2009-10-14 05:43:28 EDT
>>This depends on JUnit 4.7 shipping with Eclipse (see bug 272418)
>I don't think so.
OK, I see what you meant (ParallelComputer).
Comment 7 Chris Simmons CLA 2011-07-21 04:42:05 EDT
(In reply to comment #5)
> Furthermore,
> running tests in parallel without any constraints is just doomed to fail.

It could be an option on the runner like you have the option to run plugin tests in the UI thread or not, disabled by default.  Obviously not all tests are safe to run in parallel (UI tests being an obvious example) but for well encapsulated tests with independent fixtures this shouldn't be a problem.

I've had a brief look at the code and I'm not clear that the eclipse junit runner uses the junit code mentioned above in the first place.  It looks like there's a lot of code wrapping junit to make the UI work (eg JUnit3TestReference) in which case this might be implementable on top of the junit framework.