Use this file to discover all available pages before exploring further.
Gatling’s Expression Language (EL) is a lightweight templating system that lets you embed dynamic, per-user values into request parameters, URLs, headers, and body strings without writing full Java, Kotlin, or Scala functions. When a Gatling SDK method receives a String argument, it checks whether that string contains #{...} placeholders and, if so, resolves them against the virtual user’s current Session at request time. This means that attributes populated by feeders, previous checks, or exec(session -> ...) blocks are instantly available in any subsequent EL-capable method call.
EL interpolation only happens inside Gatling SDK method arguments. You cannot use "#{foo}" inside your own helper methods or pass it to standard Java/Kotlin/Scala functions—the #{...} token will be treated as a literal string.Wrong:
queryParam("lat", Integer.parseInt("#{latitude}")) // parseInt receives the literal string "#{latitude}"
Right:
queryParam("lat", session -> session.getInt("latitude")) // use a function instead
EL expressions use the #{attributeName} syntax. The attribute name must exactly match a key stored in the virtual user’s Session.
// Direct attribute access"#{username}"// Access an element by index (0-based, or negative to count from the end)// Works with arrays, Java List, Scala Seq, and Scala Product"#{items(0)}" // first element"#{items(-1)}" // last element// Access a nested field by key// Works with Java Map, Java POJO, Java records, Scala Map, and Scala case class"#{user.email}""#{address.city}"
The legacy ${} syntax (e.g., ${foo}) is obsolete and has been replaced by #{} to avoid clashing with Kotlin and Scala string interpolation. Always use #{}.
// Number of elements in the collection// Works with arrays, Java Collection, Java Map, Scala Iterable and Product"#{items.size()}"// A random element from the collection// Works with arrays, Java Collection, Java List, Scala Seq and Product"#{items.random()}"
// Encode as a JSON value (wraps Strings in double quotes, handles null)"#{payload.jsonStringify()}"// Decode HTML entities in a string"#{htmlBody.htmlUnescape()}"
// System.currentTimeMillis() at the moment of evaluation"#{currentTimeMillis()}"// ZonedDateTime.now() formatted with a java.time.format.DateTimeFormatter pattern"#{currentDate(yyyy-MM-dd'T'HH:mm:ss)}"
// Random UUID (fast, not cryptographically secure)"#{randomUuid()}"// Random UUID (cryptographically secure via java.util.UUID#randomUUID)"#{randomSecureUuid()}"
Double literals in randomDouble must match the format -?\\d+\\.\\d+ (e.g., 0.34 is valid; .34 and 2. are not). For very large or very small ranges, the result may appear in scientific notation.
EL built-in functions can be chained and combined:
// First element of the first list inside attribute "foo""#{foo(0)(0)}"// Random element from the list stored under key "list" in the map "foo""#{foo.list.random()}"