loadtest4j-gatling

Gatling driver for loadtest4j.

License

License

Categories

Categories

Gatling Application Testing & Monitoring
GroupId

GroupId

org.loadtest4j.drivers
ArtifactId

ArtifactId

loadtest4j-gatling
Last Version

Last Version

0.10.0
Release Date

Release Date

Type

Type

jar
Description

Description

loadtest4j-gatling
Gatling driver for loadtest4j.
Project URL

Project URL

https://github.com/loadtest4j/loadtest4j-gatling
Source Code Management

Source Code Management

https://github.com/loadtest4j/loadtest4j-gatling

Download loadtest4j-gatling

How to add to project

<!-- https://jarcasting.com/artifacts/org.loadtest4j.drivers/loadtest4j-gatling/ -->
<dependency>
    <groupId>org.loadtest4j.drivers</groupId>
    <artifactId>loadtest4j-gatling</artifactId>
    <version>0.10.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.loadtest4j.drivers/loadtest4j-gatling/
implementation 'org.loadtest4j.drivers:loadtest4j-gatling:0.10.0'
// https://jarcasting.com/artifacts/org.loadtest4j.drivers/loadtest4j-gatling/
implementation ("org.loadtest4j.drivers:loadtest4j-gatling:0.10.0")
'org.loadtest4j.drivers:loadtest4j-gatling:jar:0.10.0'
<dependency org="org.loadtest4j.drivers" name="loadtest4j-gatling" rev="0.10.0">
  <artifact name="loadtest4j-gatling" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.loadtest4j.drivers', module='loadtest4j-gatling', version='0.10.0')
)
libraryDependencies += "org.loadtest4j.drivers" % "loadtest4j-gatling" % "0.10.0"
[org.loadtest4j.drivers/loadtest4j-gatling "0.10.0"]

Dependencies

compile (5)

Group / Artifact Type Version
org.loadtest4j : loadtest4j jar 0.19.0
io.gatling : gatling-core jar 2.3.1
io.gatling : gatling-http jar 2.3.1
io.gatling : gatling-app jar 2.3.1
io.gatling.highcharts : gatling-charts-highcharts jar 2.3.1

test (3)

Group / Artifact Type Version
junit : junit jar 4.12
org.assertj : assertj-core jar 3.10.0
com.xebialabs.restito : restito jar 0.9.3

Project Modules

There are no modules declared in this project.

loadtest4j-gatling

Build Status Codecov Maven Central

Gatling driver for loadtest4j.

Usage

With a new or existing Maven project open in your favorite editor...

1. Add the library

Add the library to your Maven project POM.

<dependency>
    <groupId>org.loadtest4j.drivers</groupId>
    <artifactId>loadtest4j-gatling</artifactId>
    <scope>test</scope>
</dependency>

2. Create the load tester

Use either the Factory or the Builder.

Factory

LoadTester loadTester = LoadTesterFactory.getLoadTester();
# src/test/resources/loadtest4j.properties

loadtest4j.driver.duration = 60
loadtest4j.driver.url = https://example.com
loadtest4j.driver.usersPerSecond = 1

Builder

LoadTester loadTester = GatlingBuilder.withUrl("https://example.com")
                                      .withDuration(Duration.ofSeconds(60))
                                      .withUsersPerSecond(1)
                                      .build();

3. Write load tests

Write load tests with your favorite language, test framework, and assertions. See the loadtest4j documentation for further instructions.

public class PetStoreLT {

    private static final LoadTester loadTester = /* see step 2 */ ;

    @Test
    public void shouldFindPets() {
        List<Request> requests = List.of(Request.get("/pet/findByStatus")
                                                .withHeader("Accept", "application/json")
                                                .withQueryParam("status", "available"));

        Result result = loadTester.run(requests);

        assertThat(result.getResponseTime().getPercentile(90))
            .isLessThanOrEqualTo(Duration.ofMillis(500));
    }
}

Advanced Gatling configuration

All advanced Gatling configuration can be specified in the usual gatling.conf format. Create src/test/resources/gatling.conf and place configuration overrides in there.

Control Gatling logging

To reduce Gatling log output, change the log threshold for its noisiest classes in your SLF4J logger configuration.

If you are using Logback (the default Gatling logger), you could configure logback.xml like this:

<configuration>
    <!-- Set up the root logger and appender, then include these lines -->
    <logger name="akka.event.slf4j.Slf4jLogger" level="OFF" />
    <logger name="io.netty" level="OFF" />
    <logger name="io.gatling" level="OFF" />
    <logger name="org.asynchttpclient.netty" level="OFF" />
</configuration>
org.loadtest4j.drivers
A simple load test facade for Java.

Versions

Version
0.10.0
0.9.0
0.8.0
0.7.0
0.6.0
0.5.3