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?
Asked
Active
Viewed 1.5k times
28
Eric Wilson
- 54,930
- 75
- 197
- 265
-
1@Basilevs sure, but this question googles well – Eric Wilson Jan 11 '15 at 19:15
2 Answers
24
OK, I should have searched SO better.
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 ");
}
};
}
Community
- 1
- 1
Eric Wilson
- 54,930
- 75
- 197
- 265