|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 3.41.|
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. ReadyAPI runs the Setup script before the load test starts, and the Teardown script after it ends.
For example, load 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.
When you run a distributed test, these scripts are run on the agent computers rather than on the main computer where you run the test.
Supported scripting languages
ReadyAPI supports the following scripting languages:
By default, your projects work with Groovy, but you can change the scripting language in the Project Properties panel:
|You must restart ReadyAPI for the change to take effect.|
Available scripting objects
Your load scripts have access to the following objects and their children:
A logger object which writes data to the script log.
|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 load test. Using it, you can access the underlying load test model.|
|virtRunner||An object proving methods of controlling virtual services from the load tests. It allows you to run and stop virtual services specified in ReadyAPI 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.
Editing the script
You can edit your script with the Edit button. It has the context menu with the following items:
|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.|