Creating test suites with Junit4
import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({TestClass1.class, TestClass2.class})
public class TestSuite {
//nothing
}
The @RunWith(Suite.class) gives opportunity to combine both JUnit 4 and JUnit 3 tests and test cases together:
@RunWith(Suite.class)
@Suite.SuiteClasses({
ExampleOfJunit3TestSuite.class,
ExampleOfJUnit3TestCase.class,
ExampleOfJUnit4TestSuite.class,
ExampleOfJUnit4TestCase.class})
public class BothJUnit4and3TestSuite {
}
No comments:
Post a Comment