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, 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.
My website is hosted by Liquid Web, I really like their fast and helpful support, it saved me a lot of time. Furthermore, their servers are extremely reliable, fast and stable, I don't remember when was the last time my server is down. Btw, they're offering $100 Coupon now, if you are sourcing for great hosting provider, go grab it.

Related Posts

Popular Posts