Applies to ReadyAPI 2.8, last modified on August 16, 2019
ReadyAPI uses a number of third-party libraries. It is quite possible that we will update some of these libraries or even remove them from ReadyAPI. If you use classes from these libraries, you will have to update your scripts. See a list of third-party libraries updated in ReadyAPI 2.8.0.

About Setup and Teardown scripts

You can improve and customize your load test execution to the specific needs of your environment by using custom scripts on the Scripts page. LoadUI runs the Setup script before the test starts, and the Teardown script after it ends.

API load testing with ReadyAPI: Setup and Teardown Scripts

Click the image to enlarge it.

For example, LoadUI scripts can remove log files after the test run is finished, or prepare the database before it starts. Another possible way of usage is creating an email with data about a test run in case it fails.

Supported scripting languages

LoadUI supports the following scripting languages:

By default, your projects work with Groovy, but you can change the scripting language in the Project Properties panel:

Script Language
You must restart ReadyAPI for the change to take effect.

Available scripting objects

Your LoadUI scripts have access to the following objects and their children:

Object Description
log A logger object which writes data to the script log.
The script log is disabled by default during the execution of a LoadTest, you can enable it on the Global Preferences UI Settings tab.
loadTestRunner An object giving access to context properties and related methods of ReadyAPI tests.
context An object proving methods of controlling the execution of the LoadTest. Using it, you can access the underlying LoadTest model.
virtRunner An object proving methods of controlling virtual services from the LoadUI tests. It allows you to run and stop virtual services specified in ServiceV or deployed at VirtServer.

For more information about using ReadyAPI objects in your scripts, see the Scripting Overview.

Navigating the script

If you have a large script, it may not fit into the script editor. In this case, click to open a panorama view of the editor. In this view, you can quickly hover over the needed part of the code to move to it.

API load testing with ReadyAPI: Setup scripts

Click the image to enlarge it.

Editing the script

You can edit your script with the Edit button. It has the context menu with the following items:

Menu Item Description
Undo Undoes the previous action.
Redo Redoes the action you undid.
Cut Cuts the selection.
Copy Copies the selection.
Paste Pastes clipboard contents to the caret position.
Delete Deletes the selection.
Select All Selects all text in the editor.
Folding Opens or closes folds in the editor.
Find / Replace Opens the Find/Replace dialog.
Code Completion Opens the Code Completion prompt.
Go to Line Moves the caret to the specified line.
Show Line Numbers Toggles whether line numbers are shown or not.

See Also

About Scripting in ReadyAPI
About ServiceV
Introducing VirtServer

Highlight search results