0
votes

In my Gatling test I have this test:

  val HorizonPost: ChainBuilder = exec(
    http("Horizon Post")
      .post(getRouteInfoURI).basicAuth(s"${{EnvValues.RoadsApi_Username}}", s"${{EnvValues.RoadsApi_Password}}")
      .body(ElFileBody("bodies/horizonPost.json")).asJson
      .check(status.is(200))
  )

It seems that It has problems with the 'current_timestamp' and gives this error:

    body=
The request content was malformed:
Text '{{$current_timestamp}}' could not be parsed at index 0

The JSON file is:

 "locationTimestamp": "{{$current_timestamp}}",

Can someone explain what I need to change? I'm relatively new to Gatling.

2
Can you provide horizonPost.json ? - Amerousful
Thanks for the reply, the JSON is: "locationTimestamp": "{{$current_timestamp}}", - Jasper Slokker

2 Answers

1
votes

If you're trying to use Scala string interpolation, the correct syntax is s"${foo}", not s"${{foo}}".

If you're trying to use Gatling Expression Language, the correct syntax is "${foo}" (no s), not s"${{foo}}".

0
votes

We solved this problem by storing the timestamp in a separate csv file, the only problem is that it is not the current_timestamp. Thanks for the possibilities.