Is it possible to pass session variables between different classes/different scala files?
For example I have one scala file containing a class like:
class ListAllProducts extends Simulation {
def listAll (properties: Config) : ChainBuilder = {
val min=properties.getInt(“minTime”)
val max=properties.getInt(“maxTime”)
exec(http(“List All Products”)
.get("/product").check(status.is(200))
.check(jsonPath("$…*").findAll.saveAs(“listAllResponse”)))
.pause(min,max)
}
}
I was thinking this saved an attribute to the session called “listAllResponse” but I’m having trouble accessing it from another class like (this is a separate scala file):
class GetProduct extends Simulation {
def get (properties: Config) : ChainBuilder = {
val min=properties.getInt(“minTime”)
val max=properties.getInt(“maxTime”)
//here i need to get the value of listAllResponse that i saved earlier to extract some value from it before my execute below, but I can’t access it and have tried many different ways??
val list = exec( session =>{
session.attributes.get(“listAllResponse”)
session
})
//*********************************************************
exec(http(“Get Single Product”)
.get("/product/0003").check(status.is(200))
.check(jsonPath("$…*").findAll.saveAs(“listProductResponse”)))
.pause(min,max)
.exec(session => {
//println(session)
session
})
}
}