Search code examples
gatlingscala-gatlingpebble

Gatling Pebble Templating


I am having issues resolving the dot (.) notation of pebble templating in Gatling to retrieve attributes of variables, such as Map key values.

Here's an example of a session attribute that I've defined:

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

I'm trying to replace {{ location.text }} in the following json template file with the value "Alabama":

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

However, it looks like Gatling is unable to resolve the attribute, and therefore, the result is an empty string.

I am using version 3.2.1 of Gatling.

Any help would be appreciated, thanks!


Solution

  • Answered here: https://groups.google.com/forum/#!topic/gatling/23CuH88x1Vo

    Since Pebble is a Java library... after converting the map to a java.util.Map datatype using scala.collection.JavaConverters, I was able to successfully use Pebble dot (.) notation for traversing the map.