Hi -
Can I get the current feeder values from a session function like the one below (getData)? (I’m using the 2.x snapshot from July 1, 2014). The getData function is for putting together a JSON post body including values from the csv file defined by the feeder and used by potentially different paths.
val getData = exec((session) => {
count = count + 1
the_username = session.getTypedAttribute(“username”) // wanting to get ‘username’ from the csv feeder here, but how? this does not compile (getTypedAttribute is not a method of Session and seems to be deprecated anyway)
the_password = session.getTypedAttribute(“password”) // wanting to get ‘password’ from the csv feeder here, but how?
val data: String = “”"{ “user”: “”" + the_username + “”",“password”:""" + the_password + “”"}"""
session.set(“message”, data)
}
)
val scn = scenario(“Feeder Test”)
.feed(userCredentials)
.repeat(1) {
exec(getData)
.doIfOrElse((session:Session) => count % 10 == 0) {
chain1
} {
randomSwitch (
percentage1 → chain2,
percentage2 → chain3
)
}
.pause(1000 milliseconds)
}
Thanks in advance
Tom