How to generate GUID using JMeter?
- Add Recording Controller to the Thread Group
Right-click on Thread Group -> Add -> Logic Controller -> Recording Controller
2. Add Beanshell Sampler to the Recording Controller.
Right-click on Recording Controller -> Add -> Sampler -> BeanShell Sampler
3. Add the below script to the BeanShell Sampler-
vars.put(“afoid”, “${__UUID}”.replace(“-“, “”));
afoid – it is as variable name
replace function is used to remove “-” from the generated GUID.
Replace all the actual afoid with these above variables in your JSON.
Example- “${afoid}”
{
"ao": [
{
"afoid": "${afoid}",
"fid": 234579,
"ff": [
{
"type": "groupheader-widget",
"prompt": "Group Header 7",
"identifier": "Group_Header_10",
"sub_type": "label",
"value": ""
}
}
You can check this generated GUID in the request section of the HTTP Request under Listeners in JMeter
0 Comments