Skip to content
Phillip Markert edited this page Nov 15, 2016 · 3 revisions

When a hyperpotamus script is processed, a "session" object is tracked for the duration of the script execution. The session object is the storage of data as name/value pairs that the script interacts with. These name-value pairs can be used via the interpolation engine to modify request parameters, actions, or reported script output.

Pre-loading session data

By default, hyperpotamus sessions start out empty, but there are three ways to populate the session with data before a script is executed.

  • Using the --data filename.yml command-line option to load in JSON/YAML data. The data in the file will be merged into the root of the session object. Multiple files can be added in this way, but files are processed in the order they appear on the command-line.

  • Using the --qs "key1=value1&key2=value2" command-line option to load name/value pairs directly from the command-line. The keys/values should be query-string/url encoded. Multiple parameters should be separated by a &.

  • Using the --csv data.csv command-line option to read data in from a CSV file. The header row of the CSV contains the field-names. Each row of the CSV file will be loaded into a new session object (merged with any session data from the --data or --qs options) and then executed as an iteration of the script. i.e. if you have a CSV file with 10 rows (plus a header), your script will be executed 10 times (once for each row).

Capturing/modifying session data mid-script

Session data may contain simple values (such as strings, numbers, booleans, or dates), as well as arrays and objects. It is also quite common to add/modify session data as a script is executed. There are numerous actions that modify session data.

In general, any data captured/modified in the session is immediately available to be used in the script.

Clone this wiki locally