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; 
0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact