Eclipse - When I build the JUnit Suite, the list of test classes is empty. What for?

I have a package with 4 test classes. I want to do JUnit Test Suite. So in Eclipse I right click my package andNew > Other > JUnit Test Suite

The wizard has a warning that "Warning: No test classes selected" and the list is Test Classes to include in suite:

empty.

I'm not sure why. I have several Test.java classes with methods public

annotated with @Test

. I created them with a wizard JUnit Test Case

...

I've seen some code in other Stack Overflow answers that I could use to create a test suite, but why doesn't it work in the IDE?

Should I even worry about the test suite? It seems I can just right click the package and Run As > JUnit Test

.

+3


source to share


2 answers


Have you chosen the right package from the menu New -> Other > JUnit Test Suite

? After selecting a package using the Browse ... button, you should see your test classes.

You can run all tests directly with help Run As > JUnit Test

in the project, but if you have a lot of test classes, it is recommended to use a test suite to rearrange them (for example, slower tests, tests for a specific part of the program, etc.).



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

+1


source


Yes, don't worry about the Suites.



You can select a project and run it as a unit test. Eclipse will find all tests and run them

+2


source







All Articles