【问题标题】:Gatling Pebble Templating加特林卵石模板
【发布时间】:2020-01-31 04:46:24
【问题描述】:

我在解决 Gatling 中 pebble 模板的点 (.) 表示法以检索变量属性(例如 Map 键值)时遇到问题。

这是我定义的会话属性的示例:

session => session.set("location", Map("text" -> "Alabama"))

我正在尝试将以下 json 模板文件中的 {{ location.text }} 替换为值“Alabama”:

...
   "text": "{{ location.text }}",
...

但是,Gatling 似乎无法解析该属性,因此结果为空字符串。

我使用的是 Gatling 3.2.1 版。

任何帮助将不胜感激,谢谢!

【问题讨论】:

    标签: gatling scala-gatling pebble


    【解决方案1】:

    在这里回答:https://groups.google.com/forum/#!topic/gatling/23CuH88x1Vo

    由于 Pebble 是一个 Java 库... 使用 scala.collection.JavaConverters 将地图转换为 java.util.Map 数据类型后,我能够成功地使用圆点 (.) 表示法来遍历地图。

    【讨论】:

      猜你喜欢
      • 2016-05-27
      • 1970-01-01
      • 1970-01-01
      • 2021-01-12
      • 2011-06-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多