Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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 with 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 that has 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 duration of the VU-iteration.


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

...