Hello,
I could use some help with a custom feeder. I have a scenario using one feeder to provide user, and project. I have the user log in, then I load their project page.
Later in the scenario I want to use the ‘project’ from the first feeder as a ‘lookup’ in a second feeder.
I have an almost working solution for the second feeder, but I can’t seem to get at the session variable.
This one works, but ‘project’ is hardcoded (i.e ‘aProject’):
`
feed(csv(“projectsAndIssues.csv”).records.filter( (i: Map[String, String]) => i.get(“projectKey”).get == “aProject” ).random )
`
I tried first using Gatling Expression Language:
`
feed(csv(“projectsAndIssues.csv”).records.filter( (i: Map[String, String]) => i.get(“pkey”).get == “${project}” ).random )
`
That doesn’t work (after reading some other posts here I understand why).
So I tried using ‘project’ from the session. I am a total SCALA noob so be gentle.
I tried to add a closure to get at the session (not sure this is really a closure, but I thought it was):
`
feed(csv(“projectAndIssue.csv”).records.filter( (i: Map[String, String]) => i.get(“pkey”).get == {(session: Session) => session(“project”).as[String] } ).random )
`
Woohoo, that compiles, but my feeder is empty. I have confirmed that ‘project’ is in fact set on the session.
I feel like I have really messed this up. Could someone suggest what I could try next?
I have two data files, userProjects.csv and projectIssues.csv. I would like to take the project name from the first feed and restrict (filter) the second feed to only projects matching the current project.
userProject.csv
user, project
bob, aProject
sue, bProject
projectIssue.csv