teardown

What order are the Junit @Before/@After called?

做~自己de王妃 提交于 2019-11-28 16:16:09
I have an Integration Test Suite. I have a IntegrationTestBase class for all my tests to extend. This base class has a @Before ( public void setUp() ) and @After ( public void tearDown() ) method to establish API and DB connections. What I've been doing is just overriding those two methods in each testcase and calling super.setUp() and super.tearDown() . However this can cause problems if someone forgets to call the super or puts them at the wrong place and an exception is thrown and they forget to call super in the finally or something. What I want to do is make the setUp and tearDown methods

What order are the Junit @Before/@After called?

£可爱£侵袭症+ 提交于 2019-11-27 05:09:21
问题 I have an Integration Test Suite. I have a IntegrationTestBase class for all my tests to extend. This base class has a @Before ( public void setUp() ) and @After ( public void tearDown() ) method to establish API and DB connections. What I've been doing is just overriding those two methods in each testcase and calling super.setUp() and super.tearDown() . However this can cause problems if someone forgets to call the super or puts them at the wrong place and an exception is thrown and they