Skip to content Skip to footer

How to generate GUID using JMeter?

  1. 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

Was This Article Helpful?

0
0 Comments

There are no comments yet

Leave a comment

Your email address will not be published. Required fields are marked *

Close Bitnami banner
Bitnami