Consider setUp/@Before duration
C-Otto opened this issue · 1 comments
C-Otto commented
Description
(This might be very hard if not impossible to achieve, and I haven't seen this feature in any other tool - any insights are highly appreciated!)
The test duration and "slowThreshold" only take the individual test method runtime into account, ignoring the additional overhead introduced by setUp
(@Before
, @BeforeMethod
, etc.) code.
I'd like to see this time as part of the total test duration (summary), and see it somewhere in the individual test log output. The goal (for me) is to identify tests that are slow for ANY reason, and the setUp
phase sometimes plays a crucial part in this.
Additional information
public class SetupTakesOneSecondTest {
@BeforeClass public void beforeClass() throws Exception {
Thread.sleep(1_000);
}
@BeforeMethod public void beforeMethod() throws Exception {
Thread.sleep(1_000);
}
@AfterClass public void afterClass() throws Exception {
Thread.sleep(1_000);
}
@AfterMethod public void afterMethod() throws Exception {
Thread.sleep(1_000);
}
@Test public void testFast() { }
@Test public void testTakesOneSecond() throws Exception {
Thread.sleep(1_000);
}
@Test public void testTakesTwoSeconds() throws Exception {
Thread.sleep(2_000);
}
}
SetupTakesOneSecondTest testFast PASSED
SetupTakesOneSecondTest testTakesOneSecond PASSED (1s)
SetupTakesOneSecondTest testTakesTwoSeconds PASSED (2s)
SUCCESS: Executed 3 tests in 11.3s