Junit 4 Tutorial 5 – Suite Test
Written on
May 21, 2009 at 2:41 pm by
mkyong
The “Suite Test” means bundle a few unit test and run it together.
The “@RunWith” and “@Suite” are use to run the suite test. The below class means both unit test “JunitTest1” and “JunitTest2” run together after JunitTest5 executed. All the declaration is define inside the class.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | import org.junit.runner.RunWith; import org.junit.runners.Suite; /** * JUnit Suite Test * @author mkyong * */ @RunWith(Suite.class) @Suite.SuiteClasses({ JunitTest1.class, JunitTest2.class }) public class JunitTest5 { } |
Result
@BeforeClass – oneTimeSetUp
@Before – setUp
@Test – testEmptyCollection
@After – tearDown
@Before – setUp
@Test – testOneItemCollection
@After – tearDown
@AfterClass – oneTimeTearDown
P.S Result is from JunitTest1 and JunitTest2 unit test

