I am trying to pass today’s date in Gatling Body using session.set but no success
I have below code where using joda-time(https://www.joda.org/joda-time/) timestampfeeder variable is set
I have used below dependency in my pom.xml
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.9</version>
</dependency>
class gamekeeper extends BaseSimulation {
val timestampFeeder: String = DateTimeFormat.forPattern("yyyy-MM-
dd").print(DateTime.now())
exec { session => session.set( "TimestampFeeder", timestampFeeder )}
val createPrivateEvent ={
exec(http("Create Event As WER")
.post("https://api.cloud/" + {Env} + "/silve-griffin-service/graphql")
.headers(header)
.body(ElFileBody("/Users/Downloads/createeventasWERwithcurrentdatetime.txt"))
.check(status.in(200,201))
.check(bodyString.saveAs("EventAsWER_Response"))
.check(jsonPath(path="$.data.createEvent.id").saveAs(key="EventId")))
.exec { session => session.set("NEW_ID", session("EventId").as[String]) }
.exec{session=>println(session);session}
//.pause(40,50)
}
val scenario4 = scenario("Full GameKeeper tests“exec(createPrivateEvent).
setUp(
scenario4.inject(
constantConcurrentUsers(userCount) during(testDuration))
.protocols(httpProtocol))
.maxDuration(testDuration)
}
Seems No success in value substitution ,why session.set is not able to replace the value of TimestampFeeder