Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider setUp/@Before duration #159

Open
C-Otto opened this issue Jul 25, 2020 · 1 comment
Open

Consider setUp/@Before duration #159

C-Otto opened this issue Jul 25, 2020 · 1 comment
Assignees
Labels

Comments

@C-Otto
Copy link

C-Otto commented Jul 25, 2020

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants