Passing in created session in a feeder

I’m having issues with filling in headers using feeder Data…

In the example below I’m passing in variables for user and there secured note, secured with a SID in the head which doesn’t seem to replaced at run time. Any ideas on how to make this happen.

I create all the sessions in the feeder data turning startup of test and feed to scenerio.

 scenario("Show Notes")
      // https://gatling.io/docs/gatling/reference/current/core/session/feeder/
      .feed(finiteFeeder)
      .exec(http("ShowNotes")
        .get("https://<<HOST>>>/user/#{USER_ID}/notes/#{NOTE_ID}")
        .requestTimeout(30.seconds)
        .headers(Map(
          "accept" -> "image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8",
          "cache-control" -> "no-cache",
          "dnt" -> "1",
          "pragma" -> "no-cache",
          "sec-ch-ua" -> """Not?A_Brand";v="8", "Chromium";v="108", "Google Chrome";v="108""",
          "sec-ch-ua-mobile" -> "?0",
          "sec-ch-ua-platform" -> "macOS",
          "sec-fetch-dest" -> "image",
          "sec-fetch-mode" -> "no-cors",
          "sec-fetch-site" -> "same-origin",
        ))
        .header("_our_company_sid",s"#{sessionId}") // Replacement from feeder to add converged session
        .check(bodyString.saveAs("BODY"))

Gatling version?

Is it expected that USER_ID and NOTE_ID are in upper case while sessionId isn’t. Do they properly match keys in finiteFeeder?

They actually do, the first comes from the SQL, then I inject the sessionId before passing to the feeder

This only partially answers the second question. Please show your full code and also answer the first question.

Gatling plugin 3.1.0
Gatling version 3.8.4

show-notes.csv
USER_ID, NOTE_ID,sessionId
123,123,12343223423423

def requestShowNotes(notes_details_records: Seq[Map[String, Any]]): ScenarioBuilder = {

// For each feeder request return a random note row
val finiteFeeder = Iterator.continually(
  notes_details_records(Random.nextInt(notes_details_records.size))
)

With trace on for the request I see

GET https://<<HOSTNAME/users/
headers:
sec-ch-ua: Not?A_Brand";v=“8”, “Chromium”;v=“108”, “Google Chrome”;v="108
accept: image/avif,image/webp,image/apng,image/svg+xml,image/,/*;q=0.8
sec-fetch-site: same-origin
cache-control: no-cache
sec-ch-ua-platform: macOS
sec-fetch-dest: image
sec-fetch-mode: no-cors
_our_company_sid: #{sessionId}
pragma: no-cache

where the sessionID isn’t being replaced.

GET https://<<HOSTNAME/users/

Why isn’t there /#{USER_ID}/notes/#{NOTE_ID} in there?!
The data you provided is not consistent, please provide a reproducer as instructed here: How to Ask a Question

My best guess is that you’re not running Gatling 3.8.4 as you stated but 3.7 or older, prior to the #{} syntax was introduced.

Why the string interpolation here?

-        .header("_our_company_sid",s"#{sessionId}") // Replacement from feeder to add converged session
+        .header("_our_company_sid","#{sessionId}") // Replacement from feeder to add converged session

It’s useless but it doesn’t hurt either.

So I think you are on to something, I can see Gatling 3.8.4 is running but with the 3.1 plugin…

The #{variable} doesn’t work but ${} does so I’m assuming I need to use a newer plugin?

I can see Gatling 3.8.4 is running

No, really, that ${} is properly resolved and not #{} can only mean that you’re not running with Gatling 3.8 in your classpath but an older version. 100% sure.

Gatling plugin 3.1.0

Which plugin are you referring to? Gatling has plugins for maven, gradle and sbt.

You should upgrade to:

  • Gatling 3.9.0
  • gatling-maven-plugin 4.2.9 or gatling-gradle-plugin 3.9.0.1 ou gatling-sbt 4.2.6. Make sure to properly check the documentation: Gatling - Extensions
  • if you’re running from IntelliJ and not from the command line/plugin, make sure to refresh/reimport your project/module so that IntelliJ properly get synchronized

That was it, I thought plugin 3.1 would world with 3.8.4 gatling but it doesn’t completley…

Running 4.2.9 with Gatling 3.8.4 is working…

Now I just need to figure out how to handle redirects… :slight_smile: