Bug 111126 - [JUnit] Need to support testing multiple projects
Summary: [JUnit] Need to support testing multiple projects
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2   Edit
Hardware: All All
: P3 enhancement with 19 votes (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: fix candidate
Keywords: helpwanted
: 215325 258943 298584 346429 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-09-29 15:54 EDT by Alexander Staubo CLA
Modified: 2020-10-13 05:17 EDT (History)
23 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Staubo CLA 2005-09-29 15:54:35 EDT
The JUnit launcher is capable of finding and including all tests in a single
project, but it is not possible to select multiple projects. This makes testing
very componentized projects from within Eclipse awkward.
Comment 1 Martin Aeschlimann CLA 2005-12-04 12:06:21 EST
The Junit launcher can run only one project at a time as each project has its classpath. Only if the project are connected, e.g as a project is a required project of another then this would be possible.

Wouldn't it be easier to create a TestSuite that calls all your tests instead of running JUnit on the project? Introduce a 'required' releationship so that the test suite can also call tests in the required project.

Setting to WONTFIX for the reasons explained in the first section.

Comment 2 Martin Aeschlimann CLA 2005-12-04 12:33:51 EST
reopen. 
Comment 3 Martin Aeschlimann CLA 2005-12-04 12:35:16 EST
Running the Junit launcher on a project should also find all tests in required projects, I think.
Comment 4 Alexander Staubo CLA 2005-12-04 17:37:38 EST
(In reply to comment #1)
> The Junit launcher can run only one project at a time as each project has its
> classpath. Only if the project are connected, e.g as a project is a required
> project of another then this would be possible.

This seems like an implementation detail. At the high level, the JUnit launcher, if run against multiple projects, should be able to run each per-project test set individually and then aggregate the results.
Comment 5 Daniel Lindner CLA 2006-02-06 04:55:19 EST
The implementation running all tests of all selected projects with their own classpath and show the aggregated results would solve a major issue we currently discuss with handling our test suites.

Comment 6 David de Mingo CLA 2007-02-22 11:47:00 EST
I need support for JUnit testing in a multi project setting (equinox). I have a initial implementation that can be useful for this bug:

svn://shalma.org/shalma/trunk/org.shalma.junit
svn://shalma.org/shalma/trunk/org.shalma.junit
 
Comment 7 Darin Wright CLA 2008-01-15 12:35:27 EST
*** Bug 215325 has been marked as a duplicate of this bug. ***
Comment 8 Ilja Preuss CLA 2008-06-11 03:37:53 EDT
(In reply to comment #6)
> I need support for JUnit testing in a multi project setting (equinox). I have a
> initial implementation that can be useful for this bug:
> svn://shalma.org/shalma/trunk/org.shalma.junit
> svn://shalma.org/shalma/trunk/org.shalma.junit

I'm not able to access that repository. "Connection timed out"
Comment 9 David de Mingo CLA 2008-06-11 04:04:34 EDT
I've stopped the development of this project (now is hosted in google). You can check out the code in http://code.google.com/p/shalma as org.shalma.test bunde.
Comment 10 Ilja Preuss CLA 2008-06-16 11:02:33 EDT
I have started an Eclipse plugin, that already has some rudimentary functionality implemented. See http://sourceforge.net/projects/e-rat/

Feedback would be welcome.
Comment 11 Chris Simmons CLA 2008-08-01 11:32:48 EDT
I'd really like this feature.  We have multiple projects and I'm trying to separate the junit-plugin tests from stand-alone unit test (ie put them in different source folders within the projects concerned).

I'd ideally like to be able to create a shared run configuration for all unit tests in '<project>/unitTests/src' for a set of projects.  It would be nice if eclipse supported doing this, we've resorted to writing our own test gathering monster which has issues shall we say...
Comment 12 Markus Keller CLA 2010-01-25 08:09:02 EST
*** Bug 298584 has been marked as a duplicate of this bug. ***
Comment 13 Curtis Windatt CLA 2010-05-06 16:52:17 EDT
*** Bug 258943 has been marked as a duplicate of this bug. ***
Comment 14 Sebastian Dietrich CLA 2010-11-20 04:42:10 EST
I'm working on a huge project containing several project set files and all in all ~80 eclipse projects. Currently we have located all our unit-tests in a separate unit-test project but are going to move them to the single projects (to be more component oriented).
--> Please - in addition to "run a single test" and "run all tests in the selected project, package or source folder" provide as well the selection "run all tests in the selected project set" and "run all tests in the workspace"
Comment 15 Markus Keller CLA 2011-05-25 08:06:48 EDT
*** Bug 346429 has been marked as a duplicate of this bug. ***
Comment 16 Markus Keller CLA 2011-05-25 08:50:31 EDT
Different projects can have different requirements regarding memory allocation, JRE used, etc. . Bug 39900 should help running multiple launch configurations at once.

For this bug we'll go with comment 3:
> Running the Junit launcher on a project should also find all tests in required
> projects, I think.

The default will stay to launch only tests that are directly contained in the project, but it shouldn't be too hard to add a checkbox like this:

[ ] Also run tests from referenced projects
Comment 17 Sebastian Dietrich CLA 2011-05-25 11:23:41 EDT
(In reply to comment #16)
> [ ] Also run tests from referenced projects

IMHO that's not enough. I'd like to easily run all unit-tests in all of my eclipse projects at once, not only those referenced by a specific project. One usually hasn't one project which references all other projects.

We have already implemented a similar solution for running tests from referenced projects (by providing a find-all-tests-in-classpath test suite). Nevertheless people tend to forget adding new test projects to the all-tests-referencing-test-project
Comment 18 Micah Hainline CLA 2011-05-25 11:56:43 EDT
(In reply to comment #16)
> [ ] Also run tests from referenced projects

Just another thing to bear in mind, a lot of us put our unit tests into a fragment on a per-bundle basis.
Comment 19 Sebastian Dietrich CLA 2012-02-10 05:48:16 EST
Any news on this topic?
In the meantime we have run into the windows classpath restriction - i.e. we no longer can run all unit-tests in our projects at once (not even with our workaround)
Comment 20 Dani Megert CLA 2012-02-10 05:53:36 EST
(In reply to comment #19)
> Any news on this topic?

Nope. We won't work on this unless there's a good quality patch to review.
Comment 21 Max Bechtold CLA 2018-01-19 07:09:20 EST
There's a fairly matured code quality plug-in that features MultiProject JUnit runner - which seems to be just what this request aims at.

https://marketplace.eclipse.org/content/project-usus
Comment 22 Noopur Gupta CLA 2018-01-25 04:06:53 EST
Please check if an Eclipse Launch Group will help here: https://www.eclipse.org/eclipse/news/4.7/platform.php#launch-groups
Comment 23 Balz Guenat CLA 2018-02-20 08:42:29 EST
A Launch Group can certainly execute multiple JUnit configurations but it does not aggregate the results. You have to remember to check the test result history to see potential errors.
Comment 24 Noopur Gupta CLA 2020-01-14 00:33:03 EST
*** Bug 559125 has been marked as a duplicate of this bug. ***
Comment 25 Sebastian Dietrich CLA 2020-05-11 13:53:36 EDT
(In reply to Balz Guenat from comment #23)
> A Launch Group can certainly execute multiple JUnit configurations but it
> does not aggregate the results. You have to remember to check the test
> result history to see potential errors.

Additionally a launch group will run the tests of different projects in parallel, which might lead to weird results.
Comment 26 Sebastian Dietrich CLA 2020-05-11 14:01:30 EDT
btw - there was a project called ClassPathSuite which more or less automated the solution of referencing all projects from a super-project.
Unfortunately it does not run with JUnit 5.

I wonder how people can possibly work with eclipse on larger projects consisting of several modules. Don't they write tests or don't they run the tests in eclipse?

IMHO this bug makes eclipse useless for professional development.