加特林不会使用Feed

时间:2017-09-19 09:25:49

标签: gatling scala-gatling gatling-plugin

我有以下加特林脚本:

 val wagerFeeder = csv("wagers.csv").random

 val placeBetScenario = scenario("request")
    .feed(wagerFeeder)
.exec(http("send requests")
.post(apiPlaceBet)
    .headers(sentHeaders)
    .body(StringBody(session=>Requests.MyRequest)).asJSON
    .check(status.is(200))
  )

  setUp(
    placeBetScenario.inject(atOnceUsers(1))
  ).protocols(httpConf)

val MyRequest =
    """{
        "playerDetails" : {
          "playerId" : "playerId123"
        },
        "campaignDetails": {
          "campaignId": "dummy-campaign"
        },
        "wagerDetails":{
          "amount" : "${wagerAmount}",
          "currencySymbol": "EUR"
        }
      }"""

wager.csv内容:

wagerAmount,wagerCurrency
10,EUR
15,USD

运行后,似乎$ {wagerAmount}没有填充并保留占位符字符串

我错过了什么?

响应:

Request:
Place bet request: KO status.find.is(200), but actually found 400
=========================
Session:
Session(request,1,Map(gatling.http.cache.dns -> io.gatling.http.resolver.ShuffleJdkNameResolver@1d887911, wagerAmount -> 15, wagerCurrency -> USD),1505806932188,0,KO,List(),<function1>)

stringData={
        "playerDetails" : {
          "playerId" : "playerId123"
        },
        "campaignDetails": {
          "campaignId": "dummy-campaign"
        },
        "wagerDetails":{
          "amount" : "${wagerAmount}",
          "currencySymbol": "EUR"
        }
      }

$ {wagerAmount}应该已经替换为15.似乎来自gatling确实设法选择的日志。但它没有被替换

0 个答案:

没有答案