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

Performance issue with JUnit5 Jupiter (MockitoExtension) #1410

Open
jibidus opened this issue Jun 19, 2018 · 4 comments
Open

Performance issue with JUnit5 Jupiter (MockitoExtension) #1410

jibidus opened this issue Jun 19, 2018 · 4 comments
Labels

Comments

@jibidus
Copy link
Contributor

jibidus commented Jun 19, 2018

Hi Mockito team,

I noticed performance issue when migrating my JUnit5 Vintage tests to JUnit5 Jupiter.
You can find a small project which illustrates this behavior

To sum up, with a dummy test class, when Vintage tests take about 10ms, first Jupiter test took about 700ms, and next to follow 20ms.

Vintage tests are written with @RunWith(MockitoJUnitRunner.class) and org.junit.Test, whereas Jupter tests are written with @ExtendWith(MockitoExtension.class) and org.junit.jupiter.api.Test (with same codebase).

Stack:

  • JUnit 5.2.0
  • Mockito 2.19.0
  • Java 1.8u172
  • MacOS

Thanks for your help.

@jibidus jibidus changed the title Performance issue with JUnit5 Jupiter MockitoExtension Performance issue with JUnit5 Jupiter (MockitoExtension) Jun 19, 2018
@based2
Copy link

based2 commented Jun 24, 2018

you may try with versions updates:

based2@ad04b6a

@jibidus
Copy link
Contributor Author

jibidus commented Jun 25, 2018

If you mean Jupiter 5.2.0, benchmarks were already done with this version (see build.gradle of example project) :

dependencies {
    def junit4Version        = '4.12'
    def junitVintageVersion  = '5.2.0'
    def junitJupiterVersion  = '5.2.0'
    def junitPlatformVersion = '1.2.0'
    // JUnit ------------------------------------------------------------------
    testCompile("org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}")
    testRuntime("org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}")

    testCompile("junit:junit:${junit4Version}")
    testRuntime("org.junit.vintage:junit-vintage-engine:${junitVintageVersion}") {
        because 'allows JUnit 3 and JUnit 4 tests to run'
    }

    testRuntime("org.junit.platform:junit-platform-launcher:${junitPlatformVersion}") {
        because 'allows tests to run from IDEs that bundle older version of launcher'
    }

    def mockitoVersion = '2.19.0'
    // Mockito ----------------------------------------------------------------
    testImplementation "org.mockito:mockito-core:${mockitoVersion}"
    testImplementation "org.mockito:mockito-junit-jupiter:${mockitoVersion}"
}

If not, please let me know which artefact can be upgraded.

@TimvdLippe
Copy link
Contributor

@raphw 2.19.0 is our latest version. Did that include your perf improvements on bytebuddy or are you still working on that?

@bric3 bric3 added the junit5 label Mar 4, 2019
@jibidus
Copy link
Contributor Author

jibidus commented Oct 10, 2020

ℹ️ I just upgraded Mockito (and JUnit) to the lastest version (see POC project) : same behavior

  • JUnit 5.7.0
  • Mockito 3.5.13

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

4 participants