- Created by SS Doc Editor on Sep 09, 2021
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:
There are two types of scriptable variables that differ by the method they are created:
|
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