Hello!
I want to create a variable and assign a Random UUID(Unique identifier) to it so that I can pass this as a header for my API request. I am not able to do this in Gatling.
In Jmeter, I am able to do it very simply by using ${__UUID()} and assigning to a User Parameter.
Note: I am doing a PoC to evaluate if Gatling fits to our organization.
I tried using the below but it does not work: Any ideas on how to solve it? Documentation says I need to use Session API but I am not sure how to use. Please help.
//importing the necessary Java Utility.
import java.util.UUID;
//generate a random UUID in the Simulation Class.
UUID ninid = UUID.randomUUID();
String ninIDString = ninid.toString();
//Pass the above created variable in my header.
Private Map<CharSequence, String> headers_0 = Map.ofEntries(
Map.entry("X-Correlation-Id", "#{ninIDString}"));
Hello again!
I was able to generate a UUID at random and assign to the session variable for using in the header later but I am having trouble in using the session.setAll function, so that I can set multiple random UUID variables in the session for using them later. The below is what I am doing but I am unable to get it to work.