How do I run setup and tear-down code once for all my tests?

Mike Clark

Wrap the top level test suite in a subclass of TestSetup.

The following is a sample AllTests.suite() method:

public static Test suite() { 

    TestSuite suite = new TestSuite(); 
    // Add your tests to the suite here

    TestSetup wrapper = new TestSetup(suite) { 

        public void setUp() { 

        public void tearDown() { 

    return wrapper;