Problem:
Sometimes it is required to edit the test data present in the CSV file before using it in the JMeter script. Let’s see how to edit the test data without using the BeanShell code.
Example:
A CSV File contains below values:
‘A123’
‘B456’
‘C789’
A CSV Data Set Config Element is used to fetch these values into a variable named ‘paramVal’. Refer to the screenshot:
As per requirement, the value needs to pass in the request without quote (‘) i.e. A123, B456 and C789.
Solution:
- Add a ‘Debug Sampler’
- Add a ‘Regular Expression Extractor’ post processor under ‘Debug Sampler’
- Write an appropriate Regular Expression token to fetch the required value in the proper format. Save this value in another variable named ‘extractVal’
- Use ‘extractVal’ wherever required
The fetched value in extractVal is A123.