简体   繁体   中英

How to get gatling simulations with changing random values in it

Gatling reads the scenario at the start of the simulation and then executes it several times with the same configuration/values.

How is it possible, for example, to execute each request with the following value "RANDOM-VALUE", always with a new random value?

val postRandomValue = scenario("Post Random Value")
    .exec(
      http("POST ShipmentList")
        .post("http://localhost:8080/endpoint") // Local
        .headers(Headers.header)
        .body(StringBody("myRandomValue: RANDOM-VALUE")))

Feeders will help here

val postRandomValue = scenario("Post Random Value")
.feed(Iterator.continually(Map(
  "RANDOM_VALUE" -> java.util.UUID.randomUUID.toString
)))
.exec(
  http("POST ShipmentList")
    .post("http://localhost:8080/endpoint") // Local
    .headers(Headers.header)
    .body(StringBody("myRandomValue: ${RANDOM_VALUE}")))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM