Applies to ReadyAPI 2.7, last modified on June 25, 2019

Use the Setup, TearDown, and Report scripts to enhance test items’ functionality. This topic describes each of these script types.

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.7.0.

Setup and TearDown scripts

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 or testCase).

You can edit the scripts for the project, test suite and test case in the Setup and TearDown tabs (see Script Editors).

Setup Script tab

Click the image to enlarge it.

Tip: If the font of the editor is not comfortable for you, change it by using Ctrl + mouse wheel.

Report script

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 subreport 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 or project).

You can edit the script for the test suite and test case in the Report tab (see Script Editors).

Report Script tab

Click the image to enlarge it.

Tip: If the font of the editor is not comfortable for you, change it by using Ctrl + mouse wheel.

See Also

Scripting
Groovy Script Test Step

Highlight search results