• Stars
    star
    475
  • Rank 92,465 (Top 2 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created over 4 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Simple JMeter performance tests API

logo

Maven Central Reproducible Builds

Simple Java API to run performance tests, using JMeter as engine, in a Git and programmers friendly way.

If you like this project, please give it a star ⭐! This helps the project be more visible, gain relevance, and encourage us to invest more effort in new features.

Here you can find the .Net DSL.

Please join discord server or create GitHub issues and discussions to be part of the community and clear out doubts, get the latest news, propose ideas, report issues, etc.

Usage

If you use maven, just include the following dependency:

<dependency>
  <groupId>us.abstracta.jmeter</groupId>
  <artifactId>jmeter-java-dsl</artifactId>
  <version>1.21</version>
  <scope>test</scope>
</dependency>

Here is a simple example test in JUnit 5+ with 2 threads/users iterating 10 times each to send HTTP POST requests with a JSON body to http://my.service:

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

import java.io.IOException;
import java.time.Duration;
import java.time.Instant;
import org.apache.http.entity.ContentType;
import org.junit.jupiter.api.Test;
import us.abstracta.jmeter.javadsl.core.TestPlanStats;

public class PerformanceTest {

  @Test
  public void testPerformance() throws IOException {
    TestPlanStats stats = testPlan(
      threadGroup(2, 10,
        httpSampler("http://my.service")
          .post("{\"name\": \"test\"}", ContentType.APPLICATION_JSON)
      ),
      //this is just to log details of each request stats
      jtlWriter("target/jtls")
    ).run();
    assertThat(stats.overall().sampleTimePercentile99()).isLessThan(Duration.ofSeconds(5));
  }
  
}

This example also uses AssertJ for assertions, but you can use whatever assertion library you choose.

More examples can be found in tests

You can use this project as a starting point.

Tip 1: Check the DSL recorder and jmx2dsl to ease test plan creation or migration from existing JMX files.

Tip 2: Since JMeter uses log4j2, if you want to control the logging level or output, you can use something similar to the tests included log4j2.xml.

Tip 3: When working with multiple samplers in a test plan, specify their names to easily check their respective statistics.

Check here for details on some interesting use cases, like running tests at scale in BlazeMeter or OctoPerf, saving and loading test plans from JMX, publishing test metrics to InfluxDB (and visualizing them from Grafana), and general usage guides.

Why?

Check more about the motivation and analysis of alternatives here

Support

Join our Discord server to engage with fellow JMeter DSL enthusiasts, ask questions, and share experiences. Visit GitHub Issues or GitHub Discussions for bug reports, feature requests and share ideas.

Abstracta, the main supporter for JMeter DSL development, offers enterprise-level support. Get faster response times, personalized customizations and consulting.

For detailed support information, visit our Support page.

Articles & Talks

Ecosystem

  • pymeter: python API based on JMeter DSL that allows python devs to create and run JMeter test plans.

Contributing & Requesting features

Currently, the project covers the most used features required when implementing JMeter performance tests, but not everything the JMeter supports/provides.

We invest in the development of DSL according to the community's (your) interest, which we evaluate by reviewing GitHub stars' evolution, feature requests, and contributions.

To keep improving the DSL we need you to please create an issue for any particular feature or need that you have.

We also really appreciate pull requests. Check the CONTRIBUTING guide for an explanation of the main library components and how you can extend the library.

More Repositories

1

browser-copilot

Browser extension and framework to use and build AI assistants for any web application
Vue
106
star
2

wiresham

Simple TCP service mocking tool for replaying https://www.wireshark.org and http://www.tcpdump.org captured service traffic
Java
65
star
3

jmeter-dotnet-dsl

Simple JMeter performance tests .Net API
C#
49
star
4

ScriptGenerator

.NET Tool used to create OpenSTA script or JMeter script from Fiddler sessions.
C#
21
star
5

skywalking-copilot

A browser copilot that empowers the usage of applications that use Apache Skywalking as observability platform
Python
13
star
6

jmeter-java-dsl-sample

jmeter-java-dsl simple sample maven project
Java
9
star
7

WMIMonitor

CommandLine, API, and GUI application to read/write/execute WMI Objects
C#
8
star
8

DBMonitor

Runs SQL queries to a data base, parses the results and refreshes charts with those results
Java
6
star
9

ReplaceAll

.NET command line tool that allows replacing text in a file line by line. Very usefull to change log file format.
C#
6
star
10

selenium-jenkins-ansible

Java
5
star
11

groovyDataGenerator4SoapUI

Groovy script to generate "random" names, last names and emails for using in SoapUI
Groovy
5
star
12

AccessLogAnalyzer

.NET Tool to parse an accessLog file to create a txt report. CommadLine and GUI modes.
C#
5
star
13

genexus-ansible-playbooks

Provisioning Scripts for different platforms / tools
HTML
4
star
14

pipekins

Locally run declarative Jenkinsfiles stages
Groovy
4
star
15

selenium-jmeter-dsl-demo

Demo project that generates JMeter DSL tests from existing Selenium tests.
Java
3
star
16

examples

Examples (JMeter, Taurus and others)
CSS
3
star
17

relytest

Test Management Tool for Exploratory Testing
Java
3
star
18

SeleniumAutomationFW

Selenium, Java, testNG automation framework
Java
3
star
19

PerformanceTestScripts

Shell scripts (Batch scripts soon) to do pre and post execution tasks like start and stop monitoring tools, get logs, organize them in folders, etc.
Shell
3
star
20

GXSQLDifference

Finds the different SQL statements between two data store providers from genexus perfomance MBeans of JMX
C#
2
star
21

check_logfiles

Nagios plugins made in Perl to report on time taken entries
Perl
2
star
22

appiumTests

Project template for Android applications tests using Appium.
HTML
2
star
23

rest-assured-demo

Code used in RestAssured demo video
Java
2
star
24

jmeter-dotnet-dsl-sample

JMeter .Net DSL simple sample project
C#
2
star
25

AcademyAutomation

Java
2
star
26

sparring

HTML
2
star
27

orange_robot

Robot para migrar datos de un excel a la plataforma de "Orange"
Ruby
1
star
28

GeneraWebXml

Extensión de GeneXus para generar el archivo web.xml para tomcat 8
C#
1
star
29

poc_zap_selenium

Java
1
star
30

wrap-challenge

Project for Wrap, using Ruby + cucumber + pageobjects
HTML
1
star
31

mibTests

MIB automation project
Java
1
star
32

CsvParser

This library has as main goal to parse a Csv file and generate a Object matrix with its data.
Java
1
star
33

curso-devops-academy

JavaScript
1
star
34

appium_ruby_tests

An Appium project using Ruby to understand the usage of this framework
Ruby
1
star
35

WebAutomation

JavaScript
1
star
36

jmeter-loom-test

Use JMeter DSL to implement a new JMeter thread group using OpenJDK project Loom virtual threads and compare them to default JMeter thread group implementation.
Java
1
star