The “Suite Test” means bundle a few unit test cases and run it together. In Junit, both @RunWith and @Suite annotation are used to run the suite test.

The below example means both unit test JunitTest1 and JunitTest2 will run together after JunitTest5 is executed.

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
 * JUnit Suite Test
 * @author mkyong
public class JunitTest5 {


@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

Tags :
Founder of and, love Java and open source stuff. Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider make a donation to these charities.

Related Posts

Popular Posts