โ† Back to 30-Day Challenge

๐Ÿ”— Correlation & Realism ยท Days 13โ€“18

Day 14: Login & Sessions

Objective

Script an authenticated flow with per-user sessions.

Scenario

Create a test with 5 unique users. Each logs in, performs an action, and logs out. Ensure sessions are isolated per virtual user.

Metrics to Watch

auth failuressession reuse errors

When It Clicks

Shared sessions create false concurrency and skew results.

Solution

In JMeter: add an HTTP Cookie Manager and HTTP Header Manager at Thread Group level (not test plan level - this scopes them per virtual user). Use a CSV Data Set Config with username/password columns, 'Sharing mode = Current thread' to ensure each VU reads its own row. Each VU logs in, gets its own session cookie, performs actions, then logs out. In k6: create a cookieJar per VU with `http.cookieJar()` and pass it in request params. Verify isolation by asserting each response contains the correct username.

Reflection

If all users shared one session, what performance illusion would that create?

Deliverable

An authenticated multi-user script with isolated sessions.

โš ๏ธ Never run load tests against infrastructure you do not own or have explicit written permission to test. Always use a dedicated test environment. Unauthorized load injection can cause outages, trigger legal liability, and violate terms of service.