Use variables and validations in sequences

Let’s work with variables and validations inside a Performance sequence. These tools let you parameterize values, generate dynamic inputs, and add checks that verify system behaviour during a load test.

To begin, identify the part of your script where you want to replace a hard-coded value with a variable. In this example, the goal is to parameterize an image file name by replacing the static number with a value generated at runtime.

Click the line where the variable will be used. Before editing it, create a random value generator by inserting a randomizer. Choose the option to generate a random number and set the range by double-clicking the starting value. In the video, we set the range from 1 to 9 to match the available image options. The generated number will be stored in a variable.

With the variable created, return to the line you want to modify. The URL field displays the resource that Performance is fetching, such as an image file ending in “9.png”. Delete the hard-coded number and right-click. The variable you created appears in the context menu. Select it to insert the variable into the URL.

Press enter to confirm the change. The line previously containing the fixed value now uses the variable, meaning that each execution of this sequence will fetch a randomly selected image. This is a practical example of how to make script steps dynamic rather than static.

Performance also allows you to add active validations. For any step in the sequence, you can open the details and specify what type of content it represents. For instance, if the step is fetching an image, you can mark it as such and then right-click to add a validation to the response header. This inserts a formatted assertion directly into the script. The assertion becomes part of the execution flow and verifies that the resource matches the expected type or value.

These techniques help you make sequences more realistic, more flexible, and more precise. Variables introduce variation into the requests, while validations help ensure that the system responds correctly during performance testing.