using a session attribute, gatling running but no results show up

Hi,

For my load test i need each virtual user to use a different HTTP proxy which is running on the localhost, starting at port 10000. I use the feeder pattern to assign a port to a user,
and then obtain the port number from the session. However, I do not see the code being execute. What am I doing wrong?

Cheers,

Mark

.exec( session => {
println( session( “port” ).as[String] )
session
})
Put this in before or after your exec. You can also set your logback.xml to record what is going on, it records all the information from the requests including headers, server info and session variables. The logback is located in your ./conf folder.

<?xml version="1.0" encoding="UTF-8"?> ../gatling.log true %d{HH:mm:ss.SSS} [%-5level] %logger{15} - %msg%n%rEx

There might be an easier way but I am also new to this. :slight_smile:

Please read “exec” documentation carefully: http://gatling.io/docs/current/general/scenario/#exec

We have a large warning explaining why what you’re doing doesn’t work.

Stéphane,

Thank you. Can you learn me how it can be done? the proxy port is fed using a feeder, and if I could get it as an integer, the code that would work is :

def getRandomPort() = Map(“port” → (10000 + r.nextInt(vpnClientCount)))
val feeder = Iterator.continually(getRandomPort)

val scn = scenario(“GRPC Load”)
.feed(feeder)
.during(loadtestDuration)(pace(loadtestPace)
.exec(http(“PaasMonitor status”)
.get("/status")
.proxy(Proxy(“localhost”, “${port}”).toInt))
.check(status.is(200)))

This code works if I hard code the Proxy(“localhost”, 10000)

Cheers,

Mark