github abstracta/jmeter-java-dsl v0.8
0.8

latest releases: v1.29.1, v1.29, v1.28.1...
3 years ago

It is now possible to use RegexExtractors! Here is an example:

import static org.assertj.core.api.Assertions.assertThat;
import static us.abstracta.jmeter.javadsl.JmeterDsl.*;

import java.io.IOException;
import java.time.Duration;
import org.eclipse.jetty.http.MimeTypes.Type;
import org.junit.jupiter.api.Test;

public class PerformanceTest {

  @Test
  public void testPerformance() throws IOException {
    TestPlanStats stats = testPlan(
        threadGroup(2, 10,
            httpSampler("http://my.service/accounts")
                .post("{\"name\": \"John Doe\"}", Type.APPLICATION_JSON)
                .children(
                    regexExtractor("ACCOUNT_ID", "\"id\":\"([^\"]+)\"")
                ),
            httpSampler("http://my.service/accounts/${ACCOUNT_ID}")
        )
    ).run();
    assertThat(stats.overall().elapsedTimePercentile99()).isLessThan(Duration.ofSeconds(5));
  }

}

Additionally:

  • Fix issue causing improper order of samplers execution
  • Fix JSR223 Test elements language() method to allow use it in fluent api style
  • Remove deprecated code and refactor code to simplify it

Don't miss a new jmeter-java-dsl release

NewReleases is sending notifications on new releases.