简体   繁体   English

如何通过改变随机值获得加特林模拟

[英]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. Gatling 在模拟开始时读取场景,然后使用相同的配置/值执行几次。

How is it possible, for example, to execute each request with the following value "RANDOM-VALUE", always with a new random value?例如,如何使用以下值“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}")))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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