galax-io / gatling-picatinny   1.24.0

Apache License 2.0 GitHub

Gatling DSL extensions — feeders, profile management, transactions, assertions, Redis integration, and utility functions

Scala versions: 2.13

Gatling Picatinny

CI Tests Maven Central codecov License Scala Steward badge

Gatling DSL extensions library — production-ready utilities for feeders, transactions, assertions, templates, config management, JWT generation, Redis integration, and more. Build faster, more reliable performance tests.


Contents


What & why

Gatling Picatinny is best for teams that write Gatling load tests and need production-grade helpers on top of the core DSL: structured config, realistic data feeders, signed JWTs, Redis-backed scenarios, reusable transaction blocks, and response-time assertions — without writing all of that from scratch. It is a Test-scoped library that plugs into the standard Gatling DSL; you keep writing normal simulations and reach for Picatinny where the core DSL leaves a gap.

Start here

Step 1 — Add the dependency

Pick the snippet for your build tool in Installation, then come back here.

Step 2 — Open an example project

The examples/ folder contains source overlays for all three languages. Each overlay is applied on top of a project generated by the galaxio CLI — none of them are standalone runnable on their own. Generate a project with the CLI first, then open the Debug simulation as your entry point. See Examples & Testing for the full table.

Step 3 — Find the feature you need

I want to… Go to
Share baseUrl, intensity, and custom vars across scenarios Configuration
Generate realistic test data (names, phones, UUIDs, CSV rows) Feeders
Wrap request groups into named transactions with latency stats Transactions
Attach a signed JWT to every request JWT
Share state between virtual users via Redis Redis
Assert response-time percentiles after a run Assertions
Render dynamic request bodies from JSON/XML DSL + file templates (Gatling EL) Templates
Tame logs / mask secrets / configure the startup banner Logging & Secret Masking

Compatibility

Picatinny version Gatling Scala Java Branch
since 1.12.0 — latest (Releases · Maven Central) 3.13.x 2.13 17+ main
0.16.0 – 0.18.2 (archived) 3.11.x 2.13 17+

main always tracks the newest stable Gatling; 3.13.x has been supported since 1.12.0.

Which version should I use?

  • Gatling 3.13 (current) — use the latest release from main (see Releases). 3.13.x supported since 1.12.0.
  • Gatling 3.11 (legacy) — use 0.18.2; that line is no longer actively developed.

Branch strategy: main tracks the latest stable Gatling release (currently 3.13.x). There is no separate long-term branch for older Gatling lines.

Installation

Replace VERSION with the latest — see the Maven Central badge at the top or the Releases page.

Scala (sbt) — Gatling 3.13

libraryDependencies += "org.galaxio" %% "gatling-picatinny" % "VERSION" % Test

Java / Kotlin (Gradle Kotlin DSL) — Gatling 3.13

gatling("org.galaxio:gatling-picatinny_2.13:VERSION")

Maven — Gatling 3.13

<dependency>
  <groupId>org.galaxio</groupId>
  <artifactId>gatling-picatinny_2.13</artifactId>
  <version>VERSION</version>
  <scope>test</scope>
</dependency>

Legacy — Gatling 3.11

sbt:

libraryDependencies += "org.galaxio" %% "gatling-picatinny" % "0.18.2" % Test

Gradle (Kotlin DSL):

gatling("org.galaxio:gatling-picatinny_2.13:0.18.2")

Maven:

<dependency>
  <groupId>org.galaxio</groupId>
  <artifactId>gatling-picatinny_2.13</artifactId>
  <version>0.18.2</version>
  <scope>test</scope>
</dependency>

Quickstart

A minimal simulation wiring Picatinny SimulationConfig (shared baseUrl/intensity/durations) and the startup banner into the standard Gatling DSL:

import io.gatling.core.Predef._
import io.gatling.http.Predef._
import org.galaxio.gatling.config.SimulationConfig._
import org.galaxio.gatling.utils.Utility

class Quickstart extends Simulation {
  val httpProtocol = http.baseUrl(baseUrl)

  val scn = scenario("Quickstart").exec(http("home").get("/"))

  val injection = (
    rampUsersPerSec(0).to(intensity).during(rampDuration),
    constantUsersPerSec(intensity).during(stageDuration),
  )

  Utility.banner(injection) // workload banner, emitted via SLF4J

  setUp(scn.inject(injection._1, injection._2)).protocols(httpProtocol)
}

simulation.conf (under src/test/resources):

baseUrl = "http://localhost"
intensity = "60 rpm"
rampDuration = 1 minute
stageDuration = 5 minutes

Run it, overriding any value with -D:

sbt Gatling/test -DbaseUrl=https://test.example.org -Dintensity="120 rpm"

The banner and all config/diagnostic output go through SLF4J; Picatinny ships no logback.xml. Add the recommended config so output renders the way you expect — see Logging & Secret Masking.

Key features

Short tour of the most-used pieces. Full per-feature docs are in the Documentation catalog below.

Configuration

SimulationConfig shares baseUrl, intensity, ramp/stage/test durations and your own params across scenarios, with -D overrides and validation on first read. Values are masked when logged (see secret masking).

import org.galaxio.gatling.config.SimulationConfig._

http.baseUrl(baseUrl)                       // shared HTTP base
val region = getStringParam("region")       // custom param from simulation.conf or -Dregion=eu
rampUsersPerSec(0).to(intensity).during(rampDuration)

Full reference → docs/configuration.md.

Feeders

Composable Faker API generators (domain-oriented: names, phones, finance, RU docs) plus legacy Random*Feeder one-liners, HC Vault, CSV/SeparatedValuesFeeder and phone feeders — all produce standard Gatling feeders.

import org.galaxio.gatling.feeders.faker.Predef._
import org.galaxio.gatling.feeders.faker._

val users = GeneratedFeeder(
  "email"  -> Faker.internet.email(),
  "phone"  -> Faker.phone.mobile(Country.RU, PhoneFormatMode.E164),
  "amount" -> Faker.finance.amount(BigDecimal(100), BigDecimal(5000)),
)

Full reference → docs/feeders.md · Faker API → docs/faker-api.md.

JWT

Generate HMAC (HS*) or RSA/EC (RS*/ES*) JWTs, with a standard-claims DSL, EL placeholders for per-user claims, PEM key loading, and a bearer-token helper. Tokens land in the session for signing requests.

import org.galaxio.gatling.utils.jwt._

val gen = jwt("HS256", "my-secret")
exec(_.setJwtAsBearer(gen))                 // adds Authorization: Bearer <token>
// or store it: .exec(_.setJwt(gen, "jwtToken"))

Full reference → docs/jwt.md.

Transactions

Group request chains into named transactions with their own latency/throughput stats. The simulation extends SimulationWithTransactions.

import org.galaxio.gatling.transactions.Predef._

exec(Actions.createEntity())
  .startTransaction("checkout")
  .exec(Actions.insertTest()).pause(2).exec(Actions.selectTest)
  .endTransaction("checkout")

Full reference → docs/transactions.md.

Logging & secret masking

These behaviors arrive in 1.23.0 (current main, not yet released). On the latest published release they behave as before — see the 1.23.0 migration notes.

Output goes through SLF4J; the library ships no logback.xml (you stay in control). Secrets are redacted at every log/print/exception sink — keys whose last segment is a sensitive term (password, secret, token, apiKey, bearer, credentials, … and separator-less forms like dbpassword) become ******; benign ones (roleId, tokenBucketSize) stay visible. Add your own terms; toggle the banner with the enable flags.

picatinny.redaction.additionalSensitiveKeys = ["tenantRef"]   # extend masking
picatinny.startup.banner.enabled = true                       # the on/off knob

Full reference + recommended logback.xml + 1.23.0 migrationdocs/logging.md.

Documentation

Topic What it covers
Configuration SimulationConfig: baseUrl/intensity/durations, custom vars, validation, secret masking at read time
Feeders Faker API (full reference), legacy Random*Feeder, HC Vault, SeparatedValuesFeeder, phone feeders
Logging & Secret Masking SLF4J setup, recommended logback.xml, startup banner & diagnostics, secret redaction, 1.23.0 migration notes
Profile Profile DSL: load HTTP/custom profiles from HOCON/YAML
Redis Redis commands as Gatling scenario actions
Templates JSON/XML body DSL + file-based template loading
JWT JWT generation: HMAC/RSA/EC, claims DSL, bearer helper
Assertions NFR assertions from YAML (percentiles, error rate)
Transactions startTransaction/endTransaction with pause-inclusive latency
Examples & Testing Scala / Java / Kotlin example overlays and how to run them
Migration Guide Per-version upgrade matrix + before/after code for spec-kit releases (1.16.0+)

Contributing

# Build
sbt compile

# Run unit tests
sbt test

# Run integration tests
sbt IntegrationTest/test

# Check formatting
sbt scalafmtCheckAll

# Format code
sbt scalafmtAll

License

Apache License 2.0. See LICENSE for details.