Skip to content

Latest commit

 

History

History
57 lines (37 loc) · 2.19 KB

File metadata and controls

57 lines (37 loc) · 2.19 KB

Gatling

Simulations

Each user has its own session (including cookies, saved values). repeat in a scenario will reuse these values for each iteration, so to have independent iterations you'll need new users.

  • Injection allows you to specify users per/second (optionally ramped, and over a duration).
    • Can also specify a fixed number of atOnceUsers, but they'll end once their scenario ends.
  • Can Throttle users to a max requests/second (for a duration), but that includes all requests (including silent ones).
    • You'll still need to carefully specify the number of injected users (if too high, then you'll get too many requests from the first step in a scenario).

Combine common and specific headers with ++ with 2 maps of headers:

val commonHeaders = Map("X-CDB-CLIENT-ID" -> cfg.getString("gateway.headers.client-id"), ...)
protected val mediencenterHeaders: Map[String, String] = Map("X-CDB-USER-TOKEN"->cfg.getString("gateway.token.user")) ++ commonHeaders

Checks

CSS:

Uses CSSelly, which is an implementation of the W3C Selectors Level 3 specification

.check(css("html:root > body.purchase").exists

HTML

    .protocols(HttpConfig.httpConf.inferHtmlResources(WhiteList(".*")))

Nodes

Uses Jodd Lagarto Node objects

Extract form inputs (to be resubmitted later):

.check(css("""div.myform input""").ofType[Node].findAll
  .transform(inputNodes => inputNodes.map(n => (n.getAttribute("name"), n.getAttribute("value"))))
  .saveAs("purchaseForm")))

// ...

.exec(http("Make purchase")
  .formParamSeq("${purchaseForm}")