Prev Next

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.

A common cause of intermittent correlation failures with rotating tokens is:
A recommended safeguard is to:

More Related questions...

What is Apache JMeter? What is a Test Plan in JMeter? What is a Thread Group in JMeter? What is a Sampler in JMeter? What are Listeners in JMeter? What is a Config Element in JMeter? What are Timers in JMeter? What are Assertions in JMeter? Define a Logic Controller in JMeter? What is the CSV Data Set Config element? What is the HTTP(S) Test Script Recorder? Describe the Aggregate Report listener? What is a Regular Expression Extractor? What is Non-GUI mode in JMeter? What are Pre-Processors and Post-Processors in JMeter? What is the Constant Timer? Describe the HTTP Cookie Manager? What is a JMeter Property? List the protocols JMeter supports for load testing? How do you record a test script in JMeter? What is the difference between a Sampler and a Controller in JMeter? How does the ramp-up period affect a JMeter test? Why should you avoid running load tests in GUI mode? What is the difference between Correlation and Parameterization? How does the CSV Data Set Config distribute data across threads? When should you use a Transaction Controller? What is the difference between JSR223 and BeanShell elements? How do JMeter Assertions differ from Post-Processors? What is the difference between Response Time and Latency in JMeter? Why is the View Results Tree listener discouraged during load runs? How does the Constant Throughput Timer control request rate? What is the difference between a Loop Controller and a While Controller? When should you use the If Controller versus a separate Thread Group? How do you pass command-line properties into a JMeter test? What is the difference between master-slave distributed testing and running tests locally? How does JMeter's Cache Manager simulate real browser behavior? What is the difference between load testing, stress testing, and spike testing? Why do you need to correlate dynamic values like session tokens? Explain the execution flow of a JMeter test plan with nested thread groups and controllers? How can you optimize JMeter for generating high load with limited hardware? How do you troubleshoot inconsistent response times across distributed JMeter load generators? Explain the internal working of JMeter's distributed (master-slave) testing architecture? How can you optimize a test plan for lower memory use in a soak test? Which is better for extracting dynamic values: Regular Expression Extractor or JSON Extractor, and why? How do you troubleshoot a JMeter test producing artificially low response times due to caching? Explain the lifecycle of a single HTTP sampler request through JMeter's processor chain? How can you optimize correlation for an application using rotating CSRF tokens? How do you troubleshoot a connection reset spike during scaled-up load? Explain the execution flow of generating an HTML dashboard report from a JTL results file? How can you optimize JMeter script maintainability for a large, growing regression suite?
Show more question and Answers...

API

Comments & Discussions