Skip to content

JUnit5 Jupiter Parallel Load Extension

authorjapps edited this page May 5, 2019 · 12 revisions

Parallel Running as well as Load and Stress Testing of JUnit5 tests

Existing JUnit5 tests

In the HelloWorld performance test repo, the below are the JUnit5 tests

image

Generating Load

Or we can call running the tests in parallel as configured

image

What is JUnit5LoadTest ?

  • This generates load as configured in the @LoadWith("load_generation.properties")

What is JUnit5LoadCommonLoadTest ?

  • If your load generation configuration is same for all kind of load you are setting up to generate, then you can annotate the config at the class level @LoadWith("load_generation.properties")

e.g.

@LoadWith("load_generation.properties")
@ExtendWith({ParallelLoadExtension.class})
public class JUnit5LoadCommonLoadTest {
   //...
}

What is JUnit5LoadDifferentLoadTest ?

  • If your load generation configuration is different for different kind of load you are setting up to generate, then, you need to annotate the config at the method level @LoadWith("load_generation.properties")

e.g.

@ExtendWith({ParallelLoadExtension.class})
public class JUnit5LoadDifferentLoadTest {

    @Test
    @DisplayName("1sec gap per user - Firing parallel load for X and Y scenarios")
    @TestMappings({
            @TestMapping(testClass = JUnit5Test.class, testMethod = "testX"),
            @TestMapping(testClass = JUnit5Test.class, testMethod = "testY")
    })
    @LoadWith("load_generation.properties")
    public void testLoad_xy() {
        // This space remains empty
    }

Blogs

Clone this wiki locally