TruWeb JavaScript SDK

This section describes the TruWeb JavaScript SDK.

Note:  

  • If you are writing the script manually, make sure it uses UTF-8 encoding without BOM.
  • From version 2018.11.4, the Correlations section has been deprecated. See Extractors instead.

Flow Control

This group provides functions that are responsible for the flow control of the Vuser lifecycle.

Back to top

WebRequest

This object allows you to send web requests to the AUT. When creating a WebRequest, you can pass an options object with all the configuration you need for the request. Then you can send the request asynchronously or synchronously.

Methods

Back to top

WebResponse

This object is returned as a WebRequest result. You do not need to create it on your own.

Properties

Methods

Back to top

WebSocket

Note: Supported from version 2019.2.4

An object that allows you to create a WebSocket connection to the AUT. When creating a WebSocket, you need to pass an options object with all the required configuration. You can then send and receive messages over the socket.

Methods

Back to top

Extractors

Use in WebRequest

You can specify which values are extracted from the response of a specific WebRequest by providing the extractors option parameter. This parameter is an array of extractor objects that are created using the helper constructor functions described in Extractor types, below.

Extractor types

Extractor results

The results of all the extractors are merged into a single object in the WebResponse returned from the WebRequest by the extractor name. The name is specified as the first argument of the extractor object constructor.

Note: If an extractor object has the same name as another extractor object, only the last extractor result is saved and a warning is printed to the log.

Each extractor object returns the results in a different format. For the particular format, see the particular extractor object definitions in Extractor types.

Back to top

Transactions

Transactions provide the means to measure the time it takes to execute specific, well-defined parts of the script.

Properties

Methods

Back to top

Parameters

Parameters are values generated during runtime by the runtime engine and are exposed to the script through the load.params variable.

Each time you use a parameter variable, the next value is loaded automatically based on the next value selection strategy in the parameters definition file.

For more information, see parameters.yml in TruWeb script files.

Back to top

General Methods

Back to top

Timer

Note: Supported from version 2019.2.4

An object that allows you to create a timer that fires after a specified delay. The timer can fire once, or every time the specified delay has passed, until it is stopped.

Methods

Back to top

config

A global configuration object that is used to supply various configuration data to the running Vuser.

Properties

Back to top

utils

The utils objects has some useful functions that may help you with common scripting tasks.

Methods

Back to top

Cookies

Allow you to add, remove, or clear the cookies used in web requests.

Cookie

An object that encapsulates all the fields of a cookie.

Back to top

VTS

The VTS integration API enables you to connect to a VTS server and perform various operations on it, such as reading and writing from columns, and managing indices.

VTSClient

The VTSClient is responsible for issuing commands to the VTS server. Use it to obtain other VTS-related constructs such as VTSColumn and VTSRow.

The client allows you to perform general operations that affect more than one column or row.

Methods

VTSColumn

The VTSColumn is a reference to a column in the VTS server. Use this object to perform operations on the underlying column.

Properties

Methods

VTSRow

The VTSRow is a reference to a row in the VTS server. Use this object to perform operations on the underlying row.

Properties

Methods

Back to top

File

Note: Supported from version 2019.2.4

An object that allows file operations on a particular text file.

Methods

Back to top

Correlations (deprecated)

This section has been deprecated (from version 2018.11.4) and replaced by Extractors.

Back to top

See also: