Use the Setup, TearDown, and Report scripts to enhance test items’ functionality. This topic describes each of these script types.
Important
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.54.
Setup and TearDown scripts are available in the different test items: project, test suites and test cases. Before the test engine performs each test item, it runs its Setup script. When the test item run finishes, the test engine runs its TearDown script.
The following scripting objects are available:
virtRunner – the object for controlling virtual services.
log
– the object for interaction with the log.context
– the object contains different data of the current test (e.g., properties).testRunner
– the interface of the test runner.Also, scripts access an object that represents a current test item (
project
,testSuite
ortestCase
).
You can edit the scripts for the project, test suite and test case in the Setup and TearDown tabs (see Script Editors).
![]() |
Tip
If the font of the editor is not comfortable for you, change it by using Ctrl + mouse wheel.
Below you can find several examples of how to use setup and teardown scripts in your projects.
The following Setup script runs a virtual service at the start of a test run:
The following TearDown script stops a virtual service at the end of a test run:
Below is a sample TearDown script of a test suite. The script posts the list of failed test cases to the ReadyAPI log:
The Report script is available for test suites and test cases. The test engine performs the Report script of a test item, when you generate a report for it.
The following scripting objects are available:
log
– the object for interaction with the log.report
– the object that holds all data used to populate the report. Its members allow you to add or adjust data and sub-report data that the report engine uses to fill the report template.params
– the object that contains all defined report parameters and their values.Also, scripts can access an object which represents a current test item (
testCase
,testSuite
orproject
).
You can edit the script for the test suite and test case in the Report tab (see Script Editors).
![]() |
Tip
If the font of the editor is not comfortable for you, change it by using Ctrl + mouse wheel.