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
{
 
  @BeforeClass
  public static void oneTimeSetUp()
  {
    // one-time initialization code

JUnit

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

Pages

Subscribe to OpenWritings.net RSS