Testing / Apache JMeter Interview questions
How can you optimize correlation for an application using rotating CSRF tokens?
Confirm exactly where and how often the token actually rotates first - some applications issue a fresh CSRF token on every single response, others only on specific pages or after specific actions - since extracting and reusing a token in the wrong scope is a common cause of intermittent, hard-to-reproduce correlation failures.
Use a Post-Processor scoped correctly relative to each response that actually contains a fresh token, rather than one single extractor scoped broadly across the whole thread, so that a new token value is captured and stored into the same variable name immediately after every response that legitimately issues one, keeping the variable current for whatever request needs it next.
If the token appears consistently in the same location across many different response types (like a specific response header or a consistent JSON field, rather than embedded inconsistently in HTML), prefer extracting it that way over a fragile regex pattern matched against variable HTML markup, since a structural or header-based extraction is generally far more resilient to minor page or template changes over the test's lifetime.
Add a default value and a corresponding assertion (or explicit check in a script) confirming the extraction actually succeeded before the token is used in the next request, since a silent extraction failure - the variable falling back to its default value because no match was found - produces a confusing downstream request failure that's much harder to diagnose than an immediate, clear failure right at the point of extraction.
For very high thread counts, verify the extraction and storage approach is genuinely thread-safe and using standard JMeter variables scoped correctly per thread, rather than any shared, non-thread-safe storage mechanism, since token cross-contamination between threads, one thread accidentally using another thread's token, is a realistic failure mode specifically at scale that may not show up at all during small-scale debugging.
More Related questions...
