Group JUnit Test Cases using @Suite.SuiteClasses

Grouping Unit Tests

At times there are certain set of unit tests we want to execute automatically. These tests may be critical or have been simply grouped for some reasons. To group JUnit test cases, we use @Suite.SuiteClasses annotation.


  1. Eclipse Mars.1
  2. JDK 7
  3. Ubuntu 14.04 LTS
  4. JUnit 4

Using @Suite.SuiteClasses

To group some tests together, we proceed by creating an empty class annotated with @Suite.SuiteClasses and indicating which test classes to include.

That’s all!

To run only the set of tests via Maven, use:

As you can see TestCase003 was never executed.



Download the Codes


Karl San Gabriel

Karl San Gabriel

Java and Enterprise Technologies Expert