In this tutorial, you will learn how to use UDV (User Defined Variables) in your JMeter script to make it reusable.
Below are the topics covered in this section:
- User Defined Variable in Test Plan.
- UserDefinedVariable config element.
- Local Variables overriding global variables
User defined variables are used to defined specific variables which can store some values which you need in different places. UserDefinedVariable are different from CSVDataSetConfig in the sense that you can have 100s and 1000s of values in CSV whereas UDV is used for small data sets.
Also, in UDV you can specify values of variable/user. This could be helpful in testing scenarios in which you want two users to use the same value and then next two users to use another value.
Another thing to keep in mind is if you have declared any variable at Test Plan level/Thread Group level and you have the same variable inside 1 out of 2 thread groups or inside a specific sampler with another value. In this case, local variable will override the global one.