eBook > The JMeter Playbook: Build, Scale, and Optimize Performance Tests
Chapter 3: Parameterization & Correlation
Hardcoded values make a test plan fragile and unrealistic. There is no guarantee you will be able to replay a recorded test without issues. Additionally, real users don’t always add the same product to the cart nor do they use the same credentials.
In this chapter you will learn how to:
- Parameterize requests with data from CSV files and built-in JMeter functions.
- Correlate dynamic server responses such as extract tokens, session IDs, and other values and feed them into subsequent requests.
These two techniques transform a static script into a dynamic, data-driven performance test.
Remember the last POST request which we sent for adding a product to the cart? The request body was the following:
{
"id": "2b8c07a1-3f99-9fce-9c55-65ebc2a17565",
"cookie": "user=c9ebe5ff-8354-749d-f3f8-73e07c67f29b",
"prod_id": 1,
"flag": false
}
Now our goal is to replace hardcoded values with dynamic values.
Let’s start with parameterizing our test plan using CSV Data Set Config.