Does session distinct between scenario?

Gatling version: 3.9.5
Gatling flavor: java kotlin scala
Gatling build tool: maven gradle sbt bundle

I read the guidelines and how to ask a question topics.
I provided a SSCCE (or at least, all information to help the community understand my topic)
I copied output I observe, and explain what I think should be.

Hi, I have 2 scenarios which each has 5 APIs , and they share 1 same API as below
Scenario 1:

 exec(API_A)
.exec(API_B)
.exec(API_C)

Scenario 2:

 exec(API_A)
.exec(API_D)
.exec(API_E)

In API_A in both scenarios, I used a same check and saveAs as below:

        .check(jsonPath("$.field").saveAs("data_generated"))

This data_generated will be used to feed into next APIs, it will expire on use.
Then move on to simulations, I put them together as

setUp(
    Scenario1,
    Scenario2
)

When I run this simulation, I notice that the user will use one data_generated only. So what I’m concerning right here is will User distinct session between scenarios? Or it will only share one session for all scenarios?
Thank you so much for reading, please don’t hestitate to ask for more information if you need

Sessions are specific to each virtual user and scenarios are executed by different virtual users.

Hi, thank for answering my question.

Is there a way that I can separate data session between scenario? Or I have to duplicate file with different saveAs value name ?

I’m not sure what you mean with these questions. They are all wrong.

It’s not very clear to me what your issue is but it feels like you’re in the situation where different virtual users get the same data from a check and you’re jumping to conclusion that you’re having a Session isolation issue. This is wrong.

If multiple virtual users get the same data from a check, it simply means that the application returned the same response. The easiest explanation is that they executed the same requests. Lower the logging level and debug your test.

Sorry for my bad English but I’m not assuming it’s session issue. I just want to know how session work if I use multiple scenario in one set up (as my example code).
Example: If I initiate a session varriable sampleVar1 in scenario 1, will this sampleVar1 be brought to scenario 2?

Example: If I initiate a session varriable sampleVar1 in scenario 1, will this sampleVar1 be brought to scenario 2?

No it won’t.
That’s exactly what I explained in my previous message.

Sessions are specific to each virtual user and scenarios are executed by different virtual users.

Thank you, I understand now.
Sorry if my bad English cause you problem :frowning:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.