Reputation: 29
I'am trying to extract values from session only once, and use it in next sessions.
//First transaction used in scenario
val goHomepage = http("OpenHomepage")
.get("/")
.headers(headers_0)
.check(css("ul.sublist a" , "href").findAll.saveAs("categories"))
In last line I've extract all the categories (e.g. Notebooks, Phones, etc.) This is my very first transaction in scenario. This categories is used in next ones.
So if I have more than one virtual user, does this mean that every time this line will perform same action and will save List of this categories for every session or overwrite itself?
If so how can I get this list only once and save it between requests, without overwriting it ? Or it's extracted just once and no need to worry about resource consumption?
Upvotes: 0
Views: 475
Reputation: 2604
if the call to 'OpenHomepage' returns the same data for each user, then each will carry the sublist in its session.
Why would you only want to execute this once? If you're trying to model 20 users each logging into the website, isn't it realistic to have them each hit the homepage?
Failing that, if the sublist of categories is reasonably constant, you could just hardcode that into your scenario or put them in a csv. Either way - if you want any kind of dynamic behaviour based on the contents of "categories", you'll need them in each user's session anyway.
If you really must execute "OpenHomepage" only once you can hack it together by doing something like what is described here
Upvotes: 0