JUnit 4 Test Suites

Adam Taylor picture Adam Taylor · Jan 19, 2009 · Viewed 71.9k times · Source

How do I create test suites with JUnit 4?

All the documentation I've seen doesn't seem to be working for me. And if I use the Eclipse wizard it doesn't give me an option to select any of the test classes I have created.

Answer

Joachim Sauer picture Joachim Sauer · Jan 19, 2009
import org.junit.runners.Suite;
import org.junit.runner.RunWith;

@RunWith(Suite.class)
@Suite.SuiteClasses({TestClass1.class, TestClass2.class})
public class TestSuite {
  //nothing
}