Skip to content
Advertisement

How do I have to format my feeder csv file, to inject a list of string elements into my JSON request in Gatling?

I am having trouble adding a list of string id’s to my JSON request body! I tried many different formatting styles … but could not figure out how to get this to work in Gatling, using the JavaDSL.

this is one of my csv formatting attempts to represent a list:

JavaScript

here the code to feed my csv data into the json request body:

JavaScript

and here the the very simple request body only containing a list of id’s:

JavaScript

This particular attempt is resolved to:

JavaScript

so it does neither resolve to a valid JSON, nor does it include the second id… Any help is well appreciated! Thanks.

Advertisement

Answer

Please properly read the CSV specification, your file is malformed. In particular:

  1. Fields containing line breaks (CRLF), double quotes, and commas should be enclosed in double-quotes. For example:
JavaScript
  1. If double-quotes are used to enclose fields, then a double-quote appearing inside a field must be escaped by preceding it with another double quote. For example:

    “aaa”,”b””bb”,”ccc”

Your file should look like:

JavaScript
Advertisement