Eclipse - When I create a JUnit Suite, the list of test classes is empty. Why?

eclipse, java, junit

Solution

Did you select the right package in the `New -> Other > JUnit Test Suite` menu ? By selecting a package with the "Browse..." button, you should see your test classes.

You can run all the tests directly with `Run As > JUnit Test` on the project but if you have many test classes it is recommended to use a Test Suite to regroup them (ex: slower tests, tests for a certain part of the program, etc.).

Take a look at this post to learn more about JUnit tests grouping.

Problem

I have a package with 4 test classes. I want to make a JUnit Test Suite. So in Eclipse, I right click my package and do `New > Other > JUnit Test Suite` The wizard has a warning that, "Warning: No test classes selected" and the list of `Test Classes to include in suite:` is empty. I'm not sure why. I have several *Test.java classes with `public` methods annotated with `@Test`. I created these through the `JUnit Test Case` wizard... I saw some code on other Stack Overflow answers that I could use to create a Test Suite, but why isn't it working in the IDE? Should I even bother with a Test Suite? It seems like I can just right click the package and `Run As > JUnit Test`.

Original source