Skip to content

JUnit5 Jupiter Parallel Load Extension

authorjapps edited this page May 5, 2019 · 12 revisions

Table of Contents

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 alternatively say - Running the tests in parallel as configured

image

What does JUnit5LoadTest example do?

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

What does JUnit5LoadCommonLoadTest example do?

  • 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 does JUnit5LoadDifferentLoadTest example do?

  • 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
    }

Reports

  • This generates CSV report only which is useful and efficient for tracing the failures
  • We have deliberately suppressed the HTML reports as they are not particularly useful for load tests
  • CSV gives us flexibility to slice n dice for analysis purpose.
  • Using CSV we can generate various throughput, 2D, 3D metrices of our performance testing

Running the Load tests as a Suite

  • This setup(JUnit5LoadDifferentLoadTest, JUnit5LoadCommonLoadTest) is already like a Suite setup
    • which means you don't need another Suite-Runner

Blogs

Clone this wiki locally