Software Development

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


Got comments or suggestions? We disabled the comments on this site to fight off spammers, but you can still contact us via our Facebook page!.

You Might Also Like