tags:

views:

202

answers:

2

I'm forced to use JUnit 3 for a particular test suite. I understand setUp() and tearDown() serve the function of @Before and @After, but is there an analogue of @BeforeClass and @AfterClass for things that should happen once before the tests start, and once after all tests are run?

A: 

No, this is a new feature in JUnit4.

Daniel Engmann
+3  A: 

OK, I should have searched SO better.

http://stackoverflow.com/questions/1646586/class-teardown-in-junit-3

public static Test suite() {
  return new TestSetup(new TestSuite(YourTestClass.class)) {

    protected void setUp() throws Exception {
        System.out.println(" Global setUp ");
    }
    protected void tearDown() throws Exception {
        System.out.println(" Global tearDown ");
    }
  };
}
FarmBoy