Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse: Running JUnit Tests in Separate Source Folders

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.

like image 648
Ben Siver Avatar asked Oct 04 '12 14:10

Ben Siver


2 Answers

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.

like image 148
Bananeweizen Avatar answered Nov 01 '22 19:11

Bananeweizen


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.

like image 25
Matthew Farwell Avatar answered Nov 01 '22 20:11

Matthew Farwell