【问题标题】:Gatling 2.0.3 - Mapping values to templateGatling 2.0.3 - 将值映射到模板
【发布时间】:2015-11-20 10:05:07
【问题描述】:

我正在尝试将值映射到模板。我正在测试网络服务。我需要填充从第一个休息呼叫到另一个休息呼叫的响应作为请求。我在下面做。

第一个 POST 调用 [BOLDED],我将响应保存为两个值。现在我将这些值传递给另一个 POST 调用[BOLDED ITALIC]。

我收到以下错误。请帮助解决这个问题 方法体的参数太多:

(bd:io.gatling.http.request.Body)io.gatling.http.request.builder.HttpRequestWithParamsBuilder

val 授权 = 场景(“授权”) .feed(correlationIdFeeder) .feed(dataFeeder) .feed(csvFeeder) .exec( http("在给定外部令牌的情况下创建 tm 令牌") .post(tokenization_endpoint) .body(ELFileBody("tokenization.json")).asJSON
.check(status.is(200))
.check(jsonPath("$.payment_token").saveAs("payment_token"))

.check(jsonPath("$.payment_transaction_id").saveAs("payment_transaction_id")) ) .exec( http("授权流程") .post(授权端点) .body(ELFileBody("authorization.json"), Map("payment_token" -> "${payment_token}", "payment_transaction_id" -> "${payment_transaction_id}", "transaction_date" -> " ${current_date}", "value" -> "${amount}" ) ).asJSON
.check(status.is(200))
.check(jsonPath("$.transaction_details.transaction_status").is("已批准")) .check(jsonPath("$.transaction_details.transaction_status_code").is("0x20")) .check(jsonPath("$.transaction_details.payment_token").is("${payment_token}")) .check(jsonPath("$.transaction_details.payment_transaction_id").is("${payment_transaction_id}")) .check(jsonPath("$.transaction_details.transaction_date").is("${current_date}")) )

谢谢你 壁画。

【问题讨论】:

    标签: gatling


    【解决方案1】:

    两件事:

    • 首先,您使用的是相当老的 Gatling 2.0.3,并且会遇到大量已修复的错误,并遗漏大量功能。当前最新版本是 2.1.7。
    • 然后,看起来您正在尝试做一些类似于 Gatling 1 中的工作方式,当时我们使用 Scalate 进行模板化。这不是现在的工作方式!使用 ELFileBody,您可以在模板中直接使用 Gatling EL。请阅读文档。

    【讨论】:

      猜你喜欢
      • 2014-02-04
      • 1970-01-01
      • 1970-01-01
      • 2017-07-24
      • 2019-04-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-14
      相关资源
      最近更新 更多