skip to content

Gatling

A load tool authored in Java, Kotlin, Scala, JavaScript or TypeScript, with named injection steps and an assertion chain that sets the exit code. Interviewers ask which step a given run needs.

on this pageshow

explore

questions

111 · 5 sections

In Gatling's open injection model, what arrival pattern does each of nothingFor, atOnceUsers, rampUsers and stressPeakUsers produce?

level: juniorimportance: must knowfreq 70%
basics
~20 s

nothingFor admits nobody and shifts the rest of the profile later. atOnceUsers starts a fixed count at one instant. rampUsers spreads a fixed count evenly over a window. stressPeakUsers spreads the same count bunched around that window's middle.

open as a page

In Gatling's closed injection model, how do you declare 300 concurrent users held for ten minutes and then brought down to 50?

level: juniorimportance: must knowfreq 66%
basics
~20 s

Chain closed injection steps in one call: constantConcurrentUsers(300) for ten minutes, then rampConcurrentUsers(300).to(50) over a wind-down window, then constantConcurrentUsers(50) if that level must be held. Java, Kotlin, JavaScript and TypeScript register them with injectClosed; Scala uses inject.

open as a page

In Gatling's open injection model, what do constantUsersPerSec(20).during(15) and rampUsersPerSec(10).to(20).during(10) each declare, and how many virtual users does each one start?

level: juniorimportance: must knowfreq 72%
basics
~10 s

Both declare an arrival rate in users per second, not a headcount. constantUsersPerSec(20).during(15) starts 300 users, 20 every second. rampUsersPerSec(10).to(20).during(10) climbs linearly from 10 to 20 a second, starting 150.

open as a page

In a Gatling simulation, what does the setUp call do and where must it appear?

level: juniorimportance: must knowfreq 82%
basics
~20 s

setUp registers this simulation's populations, each one a scenario welded to an injection profile, and returns a handle for run-wide settings such as protocols and maxDuration. It must be called exactly once, from the Simulation's constructor.

open as a page

In Gatling, which builders declare a whole stepped load profile in one expression, and what does each call in that chain set?

level: juniorimportance: must knowfreq 48%
basics
~10 s

Gatling has one staircase builder per workload model: incrementUsersPerSec(rateIncrement) and incrementConcurrentUsers(usersIncrement). Both chain .times(levels).eachLevelLasting(duration), plus optional .separatedByRampsLasting(duration) and .startingFrom(x).

open as a page

In Gatling, how do you assemble a browse-then-checkout scenario out of two reusable chain values?

level: juniorimportance: must knowfreq 72%
basics
~20 s

Store each flow in a chain value returned by a standalone exec call, then hand both to scenario("Shopper").exec(browse, checkout). Chains are ordinary values, so one scenario composes as many of them as you like, in order.

open as a page

In a Gatling scenario, how do you repeat a chain a fixed number of times or for a fixed duration, and how do the Java and Scala spellings of those loops differ?

level: juniorimportance: must knowfreq 70%
basics
~10 s

repeat(n) runs the wrapped chain n times; during(d) runs it until d has elapsed. Java, Kotlin and JavaScript attach the body with .on(...), while Scala passes it in a second parameter list.

open as a page

In Gatling, what must a Java or Kotlin simulation declare before its first request — which class does it extend, and which imports put the DSL in scope?

level: juniorimportance: must knowfreq 68%
basics
~10 s

A Gatling simulation in Java or Kotlin extends io.gatling.javaapi.core.Simulation and needs two imports per DSL family: the package wildcard for the types, plus a static import of CoreDsl and HttpDsl for the DSL methods.

open as a page

Which npm packages does a Gatling HTTP simulation written in JavaScript or TypeScript depend on, and which of them provides the gatling command-line tool?

level: juniorimportance: must knowfreq 45%
basics
~10 s

Three: @gatling.io/core for the DSL and the simulation function, @gatling.io/http for the HTTP protocol builder, and @gatling.io/cli, a dev dependency that supplies the gatling command you invoke as npx gatling.

open as a page

In a Gatling scenario, how long does pause(10) wait, and what does pause(1, 4) do differently?

level: juniorimportance: must knowfreq 68%
basics
~20 s

pause(10) waits a fixed ten seconds: a bare number means seconds in every Gatling SDK. pause(1, 4) draws a fresh duration uniformly at random between one and four seconds each time a virtual user reaches that step.

open as a page

In Gatling, what are the six ordered steps of a check, and which of them does Gatling supply for you when you leave them out?

level: juniorimportance: must knowfreq 68%
basics
~20 s

A Gatling check is an ordered chain of six steps: pick a check type, extract an occurrence, transform it, validate it, name it, save it. Only two are supplied when omitted: an implicit find() and an implicit exists().

open as a page

In a Gatling simulation, which placeholder syntax reads a value back out of the Session, and what does a request URL still written with `${}` actually send?

level: juniorimportance: must knowfreq 74%
basics
~10 s

Gatling interpolates only the #{attributeName} placeholder. The older ${...} form was removed in Gatling 3.11.0 and is no longer interpreted, so a URL containing it is sent to the server as literal characters.

open as a page

In a Gatling simulation, which built-in feeders read a character-separated file, and where must the file sit for csv("credentials.csv") to resolve?

level: juniorimportance: must knowfreq 70%
basics
~10 s

Gatling ships csv, tsv, ssv and separatedValues for delimited files, plus jsonFile, jsonUrl and sitemap. The path is resolved from your classpath root: src/main/resources or src/test/resources on the JVM, resources in the JavaScript SDK.

open as a page

In Gatling, which four record-consumption strategies can you set on a feeder, and which one applies if you set none?

level: juniorimportance: must knowfreq 68%
basics
~20 s

Gatling feeders take exactly four strategies: queue, random, shuffle and circular. Queue is the default. Queue and shuffle hand out each record once and stop the run when the stock empties; random and circular reuse records and never run out.

open as a page

In a Gatling simulation, how do you capture an order id from a JSON response body and send it on the next request, and what happens to both requests if the id is missing?

level: middleimportance: must knowfreq 74%
basics
~20 s

Attach a check to the first request: jsonPath("$.orderId").saveAs("orderId"), then read it back with the placeholder #{orderId} in the next request's URL or body. If the id is missing, the implicit exists() fails, nothing is saved, and both requests are KO.

open as a page

In a Gatling simulation, where do you register an assertions chain, and what does each link of that chain select?

level: juniorimportance: must knowfreq 72%
basics
~10 s

You register them with assertions(...) on the setUp call, in the Simulation constructor. Each assertion chains a scope, then a statistic, then a metric, then a condition - for example details("Checkout").responseTime().percentile(95.0).lt(800).

open as a page

After a Gatling Community Edition run, which panels does the generated index.html show, and what does each one plot?

level: juniorimportance: must knowfreq 55%
basics
~20 s

Gatling's index.html shows response-time ranges, a simulation card, an assertions table, the Stats table, an errors table, users start rate, concurrent users, response-time distribution, percentiles over time over successful requests only, requests per second and responses per second.

open as a page

When a Gatling simulation's assertions fail, what exit code does the Gatling process return, and what are the other codes in that set?

level: juniorimportance: must knowfreq 62%
basics
~20 s

A failed assertion exits 2. Gatling declares exactly three status codes: 0 for success, 1 for invalid command-line arguments, and 2 for assertions failed. Other load generators differ; k6 exits 99 on a breached threshold.

open as a page

A Gatling build step has been exiting 0 for months on a run that judged nothing. How does that happen, and what makes Gatling return 0 in that case?

level: middleimportance: must knowfreq 50%
basics
~20 s

A Gatling simulation that registers no assertions gives Gatling nothing to judge. It folds an empty list of assertion results into a single true and returns Success, exit code 0 — the same integer a genuinely passing run returns.

open as a page

In a Gatling run where a third of the requests failed, why does index.html's Response Time Percentiles over Time chart still look flat and fast, and which panels of the same report show the failures?

level: seniorimportance: must knowfreq 50%
basics
~20 s

That chart plots successful requests only, so timeouts and early failures never enter it. Read the % KO column, the Stats table's response-time columns, the failed bar of Response Time Ranges and the Errors table instead.

open as a page

Which command launches a Gatling simulation under Maven, Gradle, sbt and the JavaScript CLI, and how do the four names differ?

level: juniorimportance: must knowfreq 70%
basics
~20 s

Maven runs mvn gatling:test, Gradle runs ./gradlew gatlingRun, sbt runs sbt Gatling/testOnly with a class pattern, and the JavaScript CLI runs npx gatling run. Each build tool names its own entry point; there is no shared Gatling command.

open as a page

With Gatling's Community Edition, what does launching the same simulation on four load-generator machines at once actually apply to the target, and what results does it leave behind?

level: middleimportance: must knowfreq 58%
basics
~10 s

Four times the declared load. Each machine runs the whole profile independently, and Gatling's Community Edition merges nothing, so you get four results directories, four HTML reports and four separate assertion verdicts.

open as a page

A Maven project holds three Gatling simulation classes, and mvn gatling:test fails on the CI runner because more than one simulation is available - how do you make the job run the one you want?

level: middleimportance: must knowfreq 58%
basics
~10 s

Force the class. Pass -Dgatling.simulationClass=com.project.simu.CheckoutSimulation on the mvn command line, or set a simulationClass element in the plugin configuration. Under CI the goal deliberately refuses to guess when several simulations exist.

open as a page

In Gatling, how is a load profile declared, and how does that differ from a generator where you size a pool of virtual-user threads?

level: middleimportance: must knowfreq 62%
basics
~20 s

A Gatling load profile is a chain of injection step builders written in the simulation's own source and handed to a single setUp call. There is no thread pool to size, because Gatling's engine is asynchronous and does not allocate one operating-system thread per virtual user.

open as a page

Can a Gatling run decide pass or fail on its own in a CI pipeline, and at what point in the run is that verdict computed?

level: middleimportance: must knowfreq 58%
basics
~20 s

Yes. Assertions declared on setUp are all evaluated after the simulation has finished; if at least one fails the simulation fails and the process exits 2. A run that declares no assertions exits 0, because it judged nothing.

open as a page