Problem I’m trying to solve: I have different endpoints that I have to access during a test. For example:
create an order(1st endpoint)
change some settings using orderId from prev step(2-nd endpoint)
get info about order using orderID (3-rd endpoint)
I was told here that it can not be done within single scenario(as I need multiple protocols, one per endpoint) and that I should split into multiple scenarios and use .andThen to run them sequentially.
Only problem which is left is how to pass data from one scenario to another and do this per user?
Now, I don’t understand what you’re struggling with exactly. Why do you thing you need multiple scenarios and not just one single scenario where virtual users would hit endpoint1 then endpoint2 then endpoint3?
all endpoints has different base urls and headers. I was trying to solve this using protocols, is there an other way around?
I was asking here if I can attach multiple protocols to scenario and choose which one is used during an execution and you told me that it is not doable and I should go for multiple scenarios + andThen.
I’ve gone trough all docs, tuts and stackoverflow so far.
all endpoints has different base urls and headers.
You don’t have to use a protocol for this. You can perfectly define requests with absolute urls and their own headers.
I was asking here if I can attach multiple protocols to scenario and choose which one is used during an execution and you told me that it is not doable and I should go for multiple scenarios + andThen.
Well, if you ask the wrong question, you get the wrong answer
That’s why it’s very important to explain in details what you’re really trying to achieve, not the solution you have in mind.
Then to get values you need:
.exec(session => {
val sharedSession = getSharedSession(scenarioName)
session.setAll(Map(
“some_key” → sharedSession(“some_key”).as[String],
))
})