Script Basics

Document created by Chris Sommerstad Employee on Jul 22, 2017Last modified by Sheril Joseph on Aug 14, 2017
Version 2Show Document
  • View in full screen mode

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). SOASTA 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.

SOASTA 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 SOASTA 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 SOASTA CloudTest is relatively simple. The SOASTA 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 SOASTA 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: SOASTA CloudTest offers three property variables ($prop,
$sysprop, and $globalprop) that simplify setting composition,
system, and global properties.