Real user journeys are stateful: users log in, navigate, add items to a cart and check out, often relying on cookies, tokens and dynamic IDs. Advanced JMeter scenarios capture and reuse this state so that flows remain realistic under load.
Modelling Stateful, Correlated User Journeys
To model state, you chain samplers within controllers that represent steps in a journey, using correlation to pass values between them. Cookies and authentication headers are typically managed by Cookie Manager and HTTP Header Manager, while dynamic fields are extracted with post-processors.
Example stateful flow:
- Step 1: POST /login (capture auth token from JSON)
- Step 2: GET /products (use token in header)
- Step 3: POST /cart (include product ID from previous response)
- Step 4: POST /checkout (re-use session and user data)
Well-correlated journeys help you see how performance behaves across realistic end-to-end flows, not just isolated endpoints.
Common Mistakes
Mistake 1 โ Testing each endpoint in isolation only
This misses cross-step issues.
โ Wrong: Ignoring how login, cart and checkout interact.
โ Correct: Build flows that mimic key user journeys end-to-end.
Mistake 2 โ Handling authentication manually in each sampler
This duplicates logic.
โ Wrong: Repeating header configuration in every request.
โ Correct: Use shared configuration elements like Header Manager and Cookie Manager.