Gatling version: 3.10.4
Gatling flavor: [ x] java kotlin scala javascript typescript
Gatling build tool: maven [ x] gradle sbt bundle npm
I made sure I’ve update my Gatling version to the latest release
I read the guidelines and how to ask a question topics.
I provided a SSCCE (or at least, all information to help the community understand my topic)
I copied output I observe, and explain what I think should be
I have a need to select the appropriate feeder for a user based on a value parsed from the login response.
I create feeders stored in a HashMap<String, FeederBuilder> in my code so that the appropriate feeder can be selected based on the String value.
I am trying to find the technique needed to select the appropriate feeder after user login, and then use this feeder for http request data later on.
All the techniques I have tried have failed, I think because the EL variable I reference from the session does not get replaced with the value of the variable in the feed(“#{variable}”).
My first question is can EL can be used in feed()?
If so, I will need to pursue what I am doing wrong.
If no, what approaches are available to solve my problem? I have an inelegant solution working that doesn’t use a feeder, but rather just a Map read in a session block. That sets variables directly in the session that are used for my http requests.
I save one of the FeederBuilder in my session after login. I verify that the feeder has rows and can be referenced, at least in a session block. If the feeder is saved in my session with
Session newSession = session.set(“feederName”, feeder);
return session;
I attempt to reference it in my script with feeder(“#{feederName}”);
I have also tried feed(session → session.get(“feederName”);
I always get an error like:
Cannot invoke “io.gatling.javaapi.core.FeederBuilder.asScala()” because “feeder$6” is null
I know the feeder is not null because I can reference it in session blocks and see the feeder.recordsCount() is non-zero in the session.