如何在加特林机上使用这种馈线

问题描述 投票:1回答:1

我可以这样使用供料器

val feeder_global_2 = Iterator.continually(Map("time"->System.currentTimeMillis()))

  var http_conf_api1424 = http.baseUrls("http://10.156.17.143:9327").disableCaching
  val api1424 = scenario("1424/v1/kol/user/info").during(60){
    feed(feeder_global_2).
      exec(http("0_1424/v1/kol/user/info")
        .post("/v1/kol/user/info")
        .header("Stress-Flag","true")
        .header("time","${uid}")

      )}

但是当我得到这样的文件时,如何使用供纸器替换http路径,标题和帖子正文?

{"method":"POST","path":"url1","get":"","post":"xxx=1&.....","header":{"Accept-Encoding":"gzip","Content-Length":"118"}}
{"method":"POST","path":"url1","get":"","post":"yyy=1&....","header":{"Accept-Encoding":"gzip","Content-Length":"118"}}
{"method":"POST","path":"url1","get":"","post":"xxx=1&....","header":{"Accept-Encoding":"gzip","Content-Length":"118"}}
......
scala gatling scala-gatling
1个回答
0
投票

您可以通过将ELFileBody传递到.body语句中,在文件中使用加特林EL变量。

所以您可以将文件更新为

{"method":"POST","path":"${url}","get":"","post":"${body}","header":${headers.jsonStringify()}...
© www.soinside.com 2019 - 2024. All rights reserved.