Gatling fill the saveAs function with a variable


I’ve a question about the “saveAs” function.

I would like to fill in the function with a value from a CSV file. The background is that I want to dynamically generate the variables. The variable names are in a different run-time variable.


Several things:

  1. saveAs("${caseid}"): you can’t pass an EL to saveAs. It has to be a static name (the key for storing the value in the session), ie “caseid”
  2. You’re trying to use the caseid attribute in queryParam(“summary”, “${caseid}”) but the check that’s supposed to capture the value to be used here is defined on the SAME request. That doesn’t make sense. Capture should happen in one of the previous requests.

Thank you, that’s what I thought.

My problem is that I am going through a CSV list and the “CaseID” is always another. I have to save “IssueID” the pair of values “CaseID” and.

An example (If 2 lines of the CSV file to be read):

AAA → 12345
BBB → 54321


val TC_002 = http("TC_002: Development Ticket Fields 1 (Check CFs exists)")
  .get(urlBase + pathQuickEdit)
  .queryParam("id", "${AAA}")


These values are dynamic. In the first HTTP call the “IssueID” s are generated, it was to save in connection with the CaseID (From the CSV file). In the second HTTP call then I need this pair of values to the query.

With a single value, this would be no problem. But I generate many issueIds and want then over the reference CaseID on the IssueID (s) can access.

Would this be possible?

Google Trad’s German to English is not its best, it seems… :wink:

I’m not sure I get it right, but it seems that you shouldn’t be using your CSV as a feeder, but as a Map, in order to get a CaseId from an IssueId.

val issueIdsByCaseId = csv("") => record(“CaseId”) → record(“IssueId”)).toMap

// fetch the corresponding IssueId from a CaseId
exec{ session =>
val caseId = session(“CaseId”).as[String]
session.set(“IssueId”, issueIdsByCaseId(caseId))

Many Thanks!

At the moment I think it can not work this way. The IssueID is generated only after the first HTTP call and does not exist previously in the CSV file.

My CSV file looks like:




There is the CaseID. The IssueID I only here:


// Create Issue
val tc_001 = http("TC_001: Configuration (Create Issues)")
  .get(urlBase + urlPost)
  .queryParam("pid", "${pid}")
  .queryParam("issuetype", "${issuetype}")
  .queryParam("summary", "${caseId}")
  .queryParam("reporter", "${reporter}")
  .queryParam("description", "${test_id}: ${test_description}")
  .queryParam("${cf1_name}", "${cf1_value}")
  .queryParam("${cf2_name}", "${cf2_value}")
  .check (


Is this still as possible?

Could you please explain over (from the start)?
Your first example was messed up, so I really didn’t get it.

jsonPath("$.issueId") <-- searching for issueId
      .saveAs("${caseid}") <-- saving the value as caseid in a broken way


I’ve found a solution!

Many thanks.



Another question…

It is possible to interate over all CSV entries? at the moment i use a “repeat” with number ob lines… But i wont define the lines, i will use a loop over all lines.