junit4 icon indicating copy to clipboard operation
junit4 copied to clipboard

Add timeout attribute to @BeforeClass, @Before, @After, and @AfterClass

Open garydgregory opened this issue 9 years ago • 9 comments

Please add a timeout attribute to @BeforeClass, @Before, @After, and @AfterClass.

This will allow set ups and tear downs to databases and other expensive remote resources to gracefully stop and kill tests that cannot be set up properly.

garydgregory avatar Jul 19 '14 20:07 garydgregory

Have you tried using a custom Rule to do this?

kcooney avatar Jul 19 '14 23:07 kcooney

Nope. Saying @BeforeClass(timeout=10000) like we do now @Test(timeout=10000) would sure look better and consistent.

garydgregory avatar Jul 21 '14 18:07 garydgregory

Given your use case, you probably would want to have reusable objects anyway (ex: a database test fixture). I'm just trying to suggest workarounds.

Anyway, I am personally not opposed to timeout attributes. Feel free so send us a pull request, but we are really close to releasing 4.12, so it may have to wait until 4.13

kcooney avatar Jul 22 '14 02:07 kcooney

Hi, is someone working on this?

jaruk avatar Dec 18 '14 17:12 jaruk

@jaruk no one to my knowledge is working on this. Would you like to take a stab at it?

kcooney avatar Dec 19 '14 00:12 kcooney

yes

jaruk avatar Dec 19 '14 06:12 jaruk

Which JUnit release contains this change ?

Thanks

tedyu avatar Aug 23 '15 22:08 tedyu

@tedyu no one has sent a pull request for this proposed change

kcooney avatar Aug 23 '15 22:08 kcooney

@jaruk how close is your issue958 branch to being ready for review?

busbey avatar May 03 '16 16:05 busbey