JUnit - Execution order of JUnit's annotations

 * Show the execution order of each annotations.
 * Given this test, the methods will execute in the following order:
 * oneTimeSetUp()
 * setUp()
 * testMyFunction1()
 * tearDown()
 * setUp()
 * testMyFunction2()
 * tearDown()
 * oneTimeTearDown()
 * **NOTE**: JUnit doesn't guarantee the execution order of the test functions(@Test).
 * @author: Xuan Ngo
import org.junit.*;
public class JUnitCheatSheet
  public static void oneTimeSetUp()
    // one-time initialization code


JUnit is unit testing framework for the Java programming language. It allows you to easily verify the individual unit of source code through assertions.


Subscribe to OpenWritings.net RSS