Skip to end of metadata
Go to start of metadata

Scriptable variables can be created by writing .NET code. Once created, they are displayed in the Source Variable section of the workflow tree (a) and appear in the Variable Picker (b) alongside other variables.

Scriptable variables are used similarly to other source variables such as extractors, datasets, functions, and data generators. Once the scriptable variable is implemented, it can be used to parameterize requests the same way as other variables.

StresStimulus evaluates the scriptable variable before sending the request with the parameter where the variable is used ("related request"). At this moment, your custom code is executed; the return value is assigned to the variable and is used to parameterize the request.


There are two modes of evaluation of the scriptable variable: on request and iteration:


  • On request: the evaluation event takes place before issuing every related request in every iteration for every VU. Use this evaluation mode only when the variable value is expected to change on every occurrence of your code execution. 


  • On iteration: the evaluation event takes place once per VU-iteration before issuing the first related request. After that, the scriptable variable value is stored in StresStimulus and is re-used within the same iteration in any subsequent related requests, if they exist. Use this mode if the value of the scriptable variable must stay the same for the VU-iteration duration.


There are two types of scriptable variables that differ by the method they are created:

  • Internal scriptable variables are created in StresStimulus. Their benefit is simplicity as they do not require any additional development tools.
  • External scriptable variables are created by developing external .NET DLLs using Microsoft Visual Studio. This allows to develop more sophisticated functionality and behavior using external libraries and powerful development and debugging Visual Studio environment

Creating scriptable variables

To create a scriptable variable inside StresStimulus, navigate to the Scriptable Var tab (a). From there, you can create your own variable. Select one of three languages you wish to use: C#, VB.NET, or JScript.NET (b).



Give your variable a name (1) and chose when you want to evaluate it (2). StresStimulus will either evaluate the variable once per VU-iteration on the first use or every use. The script editor will then open, and you can write your code, compile it, and save it.



You can edit or delete your variable later by going back to the Scriptable Var tab, selecting the variable you wish to modify, and then clicking either Edit (c) or Delete (d). Click OK to bring up the code editor window.

  • No labels