A question regarding Gatling and variables

I’m quite new to Gatling and have been searching for a good example on how to use variables.
I’m trying to create a test script where it would be nice to have some dynamic elements.

One variable I need is an ID consisting of numbers, for example “1234567890”
The other variable is a timestamp, the current time milliseconds (I think its System.getCurrentTimeMillis)

The variales will be posted as part of a path (which is a part of a .during loop)
The path will look something like this: http://path/to/my/webbapp/${ID}/${timestamp}

Does anyone have an example of how to do this. I only get error that the ID or time is not defined.

Have you read the documentation?
There’s 3 ways of injecting data into virtual users:

  1. use a feeder: https://github.com/excilys/gatling/wiki/Feeders
  2. capture data from responses with checks: https://github.com/excilys/gatling/wiki/Checks
  3. Manually set data into session: https://github.com/excilys/gatling/wiki/Advanced-Usage#scala-functions
    For example:

.exec(session => session.setAttribute(“timestamp”, System.getCurrentTimeMillis))

I had tried all your suggestions. It turned out that I had misunderstood where to create the session variables. It all works fine now. Thanks for your help.

Great!
Have fun!