Although there is no dedicated sampler in JMeter to generate GUIDs but you can use the built-in functions to generate them.
In this article i will share with you how to generate GUID that is unique by user and iteration and use it through your JMeter thread group or test plan.
Steps:
- Open JMeter and add “Bean Shell Sampler”under your Thread Group
2. Add a user defined variable that will hold the GUID value , set the varible name and leve the value empty
3. Enter the following command in beanshell sampler
“vars.put(“VariableName”, “${__UUID}”);” where variable name is the name of variable created in the previous step.
4. Now we need to verify that it is working so , we will add “Debug Samper” & “View Results Tree”
5. Save , Run and check the debug sampler values in the results tree
6. now you can place the ${GUID} variable wherever you want in the thread group and it will generate a unique value for each user and each iteration (whenever the beanshell sampler executed).
*you can genrate more than one GUID everytime by pasting the line more than on time in the beanshell sampler and also add more variables in the user defined variables to hold the values.
Leave a Reply