github abstracta/jmeter-java-dsl v0.62
0.62

latest releases: v1.29, v1.28.1, v1.28...
2 years ago

This release includes several changes:

  • Now jmx2dsl generates a fully functional test class including imports and dependencies, so you no longer need to solve them. Here is an example:
///usr/bin/env jbang "$0" "$@" ; exit $?
/*
These commented lines make the class executable if you have jbang installed by making file
executable (eg: chmod +x ./PerformanceTest.java) and just executing it with ./PerformanceTest.java
*/
//DEPS org.assertj:assertj-core:3.22.0
//DEPS org.junit.jupiter:junit-jupiter-engine:5.8.2
//DEPS org.junit.platform:junit-platform-launcher:1.8.2
//DEPS us.abstracta.jmeter:jmeter-java-dsl:0.62

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

import java.io.IOException;
import java.io.PrintWriter;
import org.apache.http.entity.ContentType;
import org.junit.jupiter.api.Test;
import org.junit.platform.engine.discovery.DiscoverySelectors;
import org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder;
import org.junit.platform.launcher.core.LauncherFactory;
import org.junit.platform.launcher.listeners.SummaryGeneratingListener;
import org.junit.platform.launcher.listeners.TestExecutionSummary;
import us.abstracta.jmeter.javadsl.core.TestPlanStats;

public class PerformanceTest {

  @Test
  public void test() throws IOException {
    TestPlanStats stats = testPlan(
        threadGroup(2, 10,
            httpSampler("http://my.service")
        ),
        jtlWriter("test.jtl")
    ).run();
    assertThat(stats.overall().errorsCount()).isEqualTo(0);
  }

  /*
   This method is only included to make test class self executable. You can remove it when
   executing tests with maven, gradle or some other tool.
   */
  public static void main(String[] args) {
    SummaryGeneratingListener summaryListener = new SummaryGeneratingListener();
    LauncherFactory.create()
        .execute(LauncherDiscoveryRequestBuilder.request()
                .selectors(DiscoverySelectors.selectClass(PerformanceTest.class))
                .build(),
            summaryListener);
    TestExecutionSummary summary = summaryListener.getSummary();
    summary.printFailuresTo(new PrintWriter(System.out));
    System.exit(summary.getTotalFailureCount() > 0 ? 1 : 0);
  }

}
  • added constantTimer to ease specifying fixed pauses.
  • added jmx2dsl conversions for csvDataSet& responseAssertion.
  • fix regexExtractor JMX generation which was conflicting with some parsers. Eg: OctoPerf. Thanks to Octoperf team for reporting this!
  • fix JMX generation when saveAsJmx is invoked after running a test plan. Thanks to Octoperf team for reporting this!
  • fix dashboardVisualizer default visualization which was always starting with collapsed charts.

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

NewReleases is sending notifications on new releases.