Gatling Scripts-我如何在下面的请求中使用不同的纪元时间提供事件日期时间

Gatling Scripts- how can I feed the eventdatetime in the below request with different epoch time

Gatling 脚本 - 如何在下面的请求中将不同的纪元时间作为馈送器来馈送 eventDateTime。 Id 以循环方式通过馈线。下面的请求在一个使用 ELFileBody 提供的文件中。事件-new.json 看起来像

{
  "events": [
    {
      "eventDataModel": {
        "eventStatus": "ON",
        "eventDateTime": 1598271042436
      },
      "transactionModel": {
        "id": "${ID}"
      }
    },
    {
      "eventDataModel": {
        "eventStatus": "ON",
        "eventDateTime": 1598271043436
      },
      "transactionModel": {
        "id": "${ID}"
      }
    },
    {
      "eventDataModel": {
        "eventStatus": "ON",
        "eventDateTime": 1598271044436
      },
      "transactionModel": {
        "id": "${ID}"
      }
    },
    {
      "eventDataModel": {
        "eventStatus": "ON",
        "eventDateTime": 1598271045436
      },
      "transactionModel": {
        "id": "${ID}"
      }
    },
    {
      "eventDataModel": {
        "eventStatus": "ON",
        "eventDateTime": 1598271046436
      },
      "transactionModel": {
        "id": "${ID}"
      }
    },
    {
      "eventDataModel": {
        "eventStatus": "ON",
        "eventDateTime": 1598271047436
      },
      "transactionModel": {
        "id": "${ID}"
      }
    },
    {
      "eventDataModel": {
        "eventStatus": "ON",
        "eventDateTime": 1598271048436
      },
      "transactionModel": {
        "id": "${ID}"
      }
    },
    {
      "eventDataModel": {
        "eventStatus": "OFF",
        "eventDateTime": 1598271049436
      },
      "transactionModel": {
        "id": "${ID}"
      }
    }
  ]
}

以上是使用加特林脚本发布的事件-new.json 加特林脚本片段

val idFeeder = csv("Id.csv").circular
val trip_dte2 = scenario("Event")
                    .feed(idFeeder)
                    .exec(http("event")
                    .post( event_url)
                    .headers(headers)
                    .body(ElFileBody("event-new.json")).asJSON
                    .check(status.is(201)))

从 Gatling 3.3 开始:

.exec { session =>
  session.set("timestamp", System.currentTimeMillis())
}

然后将 1598271049436 替换为 ${timestamp}

或者,coming in Gatling 3.4:如果您可以在 JSON 负载中每次出现不同的值,则直接将 1598271049436 替换为 ${currentTimeMillis()}