Script Basics

A CloudTest script specifies a set of actions to be taken at a specific point in the execution of a Test Composition (via the test clip in which the script has been placed). CloudTest Scripts are written in JavaScript.

Once written, a CloudTest script is then placed into a test clip using the same method used for other clip elements (messages, browser actions, delays, etc.).

Note: For an overview of creating, editing, and placing scripts into tests, refer to Scripts.

CloudTest Object Model

In a web browser, the Document Object Model (DOM) is represented by a tree structure whose nodes can be navigated and then manipulated by a programmer using scripts. Similarly, scripts written for CloudTest make use of a simple object model.

Unlike the DOM, where added complexity can make locating a specific object in the model a challenge, the object model within CloudTest is relatively simple. The CloudTest Object Model contains pre-defined JavaScript objects to which every script has access.

The Test Composition is the root element, while other Composition objects also have an object. Together these objects comprise an object model that allows access to the Test Composition and to all of its component parts that have either public or local scope (refer to Setting and Using Message Scope).

As with the DOM, a programmer can use scripts to manipulate objects within this object model.
Pre-Defined JavaScript Variables

The CloudTest Object Model is presented via pre-defined JavaScript variables that allow user-defined scripts to access and modify the currently running Test Composition. Scripts are added as elements within one or more Test Clips within that test composition.

These pre-defined variables offer an object model variable via the Context object ( $context ), as well as direct manipulation of properties by variables ( $prop for Custom Properties, $sysprop for System Properties, and $globalprop ) for Global Properties.

Note: CloudTest offers three property variables ( $prop , $sysprop , and $globalprop ) that simplify setting composition, system, and global properties.