What is Correlation?
Correlation means extracting values from one response and reusing them in later requests. This is critical for:- Session tokens and authentication
- CSRF tokens and security nonces
- Resource IDs from created objects
- Dynamic form values (VIEWSTATE, hidden fields)
- Transaction IDs and reference numbers
Recorded scripts capture session-specific data that expires quickly. You must correlate these values to create working tests.
Extracting from JSON Responses
Most modern APIs return JSON data. Extract values by parsing the response:Extracting from HTML Forms
Web applications often include hidden fields with dynamic values. Extract them before form submission:Method 1: Using Response.submitForm()
The high-level API handles form extraction automatically:Method 2: Manual Extraction
For more control, extract specific fields manually:Extracting .NET ViewState and CSRF Tokens
Common pattern for .NET applications:Generic String Extraction
For responses that aren’t JSON or HTML, extract values using string boundaries:- findBetween()
- Regular Expression
- String Methods
Extract the first occurrence between boundaries:
Complete Correlation Example
Realistic user flow with multiple correlations:Advanced Patterns
Sharing Data Between VUs
Extract data in setup, share with all VUs:Correlation with Multiple Matches
Extract multiple values from a response:Token Refresh Pattern
Handle token expiration and renewal:Common Extraction Scenarios
OAuth 2.0 Token Flow
OAuth 2.0 Token Flow
WordPress Nonce
WordPress Nonce
Pagination with Cursor
Pagination with Cursor
Best Practices
Always Validate Extracted Data
Use Descriptive Variable Names
Handle Missing Values Gracefully
Debugging Extraction
Troubleshoot extraction issues:Related Resources
API CRUD Operations
See correlation in complete API workflows
HTTP Authentication
Extract and use authentication tokens
Test Lifecycle
Use setup() to share extracted data
API Reference: Response
Response methods for data extraction