Greetings everyone,
I’m trying to randomize my test by extracting available IDs from Json and using some random ID in next requests. As ${ID.random()} picking random ID every time it’s being called i figured i need to make some manipulations in session. So I have something like following
.exec(
http("Navigate to random subcategory")
.get("/c/${subcat}/l/latest.json")
.headers(headers_CatSub)
.check(jsonPath("$..topics[*]..id").findAll.saveAs("topicsid"))
).exec(session => {
val randId = ("${topicsid.random()}")
session.set("RandomId", randId)
})
.exec(
http("Enter random subcategory topic")
.get("/t/${RandomId}.json")
.headers(headers_CatSub)
.queryParam("track_visit", "true")
.queryParam("forceLoad", "true")
I’m getting Vector with topicsid and trying to simply put random ID to newly created session variable RandomId in order to use it in next requests to no avail. Next request will be issued like https:///t/${topicsid.random()}.json so it’s not interpreting the variable but using that value as string instead.
Would you please point me in the right direction to find out what am I doing wrong?