5

I am working on a project utilizing the OSGi specification, and the structure of the project is such that code is distributed into dozens of separate bundle folders. Is there any way to quickly run all tests in my project in Eclipse, given that they are in separate project folders? I have tried setting up a new run configuration, but this option limits you to specifying only one source folder.

I know that I can easily run all the tests through Maven, but I much prefer Eclipse's JUnit plugin for running tests.

Ben Siver
  • 2,758
  • 1
  • 25
  • 42

2 Answers2

4

Install only the "Launch groups" feature from Eclipse CDT, then create one junit launch config per project, and finally create a launch group containing all your junit launch configs.

Disadvantage: You have to update that configuration manually when adding further projects.

Community
  • 1
  • 1
Bananeweizen
  • 21,797
  • 8
  • 68
  • 88
  • 1
    Thanks, I never knew about launch groups. This looks like a good solution for me. – Ben Siver Oct 05 '12 at 16:03
  • Well, this sounded like a nice idea in theory, but seems useless in practice: What the launch group does, is that it runs one JUnit launch configuration AFTER another. This means that you see the test results of just the last configuration that was run. All previous are discarded. – Natix May 20 '15 at 12:26
2

You can run all JUnit tests in a project by right clicking on the project in the Package Explorer and selecting Run As->Junit Test

Project Run As->Junit Test

EDIT: There currently isn't any way of running all of the tests within the workspace, at least using the standard JDT.

Caveat: I haven't tried Bananeweizen's suggestion of the CDT Launch Group plugin.

You could try Inifinitest (which reruns your tests every time something changes, which is a slightly different thing.

Matthew Farwell
  • 60,889
  • 18
  • 128
  • 171
  • Thanks, but I specified in my question that I am trying to run tests across multiple "projects". Each OSGi bundle in my workspace is technically seen as a separate project by Eclipse. Simply highlighting all bundles and right clicking does not allow me to run all JUnit tests. – Ben Siver Oct 04 '12 at 15:57
  • Actually, you said multiple source folders. You can have multiple source folders in the same project. Did you mean all of the tests within the workspace? – Matthew Farwell Oct 04 '12 at 16:16
  • Apologies, I did mean multiple projects. – Ben Siver Oct 04 '12 at 21:06