Script Editors

Applies to ReadyAPI 3.53, last modified on June 26, 2024

Script editors in ReadyAPI are available in several places:

You can usually find the script editors at the bottom of the corresponding window.

The script editor

Click the image to enlarge it.

Depending on the event handler you use, various objects are available in your script. Objects that you can use in your script are in the line above the editor. For details about using ReadyAPI scripting objects, see sub-topics of this section.

Editor options

The editor can have one of the following options or both:

Option Description
Run Starts the script run.
Edit  Opens the editor menu.
Tip: Instead of clicking Edit to call the editor menu, you can right-click inside the input box.
The script editor menu

Click the image to enlarge it.

The editor menu includes the following commands:

Command Description
Undo Undoes the previous action.
Redo Redoes the undone action.
Cut Cuts the selected part.
Copy Copies the selected part.
Paste Pastes clipboard contents to the caret position.
Delete Deletes the selected part.
Select All Selects all text in the editor.
Folding Opens or closes folds in the editor.
Find / Replace Opens the Find / Replace dialog that allows you to select finding options and text to replace.
Code Completion Shows available methods and parameters.
Change Color Scheme Changes the colors of the editor by using the selected color scheme.
Go to Line Moves the caret to the specified line.
Show Line Numbers Shows or hides line numbers.

If your script is large, it may not fit into the script editor. Click Panorama View to quickly move to the part of the code you need.

You can also change the font size in the editor by rotating the mouse wheel while holding the Ctrl key (on Windows and Linux) or by sliding two fingers up or down the trackpad while holding the Command key (on macOS).

Using Property Expansions

You can use property expansions in your code to create objects holding data of other test steps:

  1. Right-click in the editor or click Edit and select Get Data.

    The Get Data function

    Click the image to enlarge it.

  2. Browse the ensuing Get Data dialog to the object or property you need.

    The Get Data function

    Click the image to enlarge it.

  3. Name the created variable.

  4. Click OK.

ReadyAPI will define the variable and create a property expansion to fill it:


def password = context.expand( '${Logout#Password}' )

You can read more about property expansions in the Property Expansion topic.

Code Completion

ReadyAPIscript editors support code completion for Groovy. As you type code, available methods and parameters will appear in a drop-down list, so you can select them and speed up the code writing.

You can also move the caret to the object, the methods and parameters of which you need to call, and press Ctrl+Space to view the list of available entities.

Code completion also shows methods and parameters from custom Java libraries and JAR libraries located in the /bin/ext and /lib directories.

Note: Code completion cannot show methods and parameters from libraries located in subfolders of the /lib folder.

Code Validation

By default, ReadyAPI automatically validates the Groovy syntax when running a script and displays a message about syntax errors and their location, if any. Sometimes, this may cause ReadyAPI performance issues. To avoid potential problems, you can disable Groovy syntax checking by using the following line: -Dgroovy.disable.syntax.checking=false.

Code Templates

ReadyAPI offers support for configurable code templates. To activate them, type the corresponding template ID in the editor and press Ctrl+Shift+Space.

You can view and edit code templates on the Code Templates page in ReadyAPI Preferences.

See Also

Code Templates
Script Libraries

Highlight search results