Groovy Script Test Step Editor

Applies to ReadyAPI 3.57, last modified on December 12, 2024

About

The Groovy Script test step allows you to execute script code as a part of your test case.

The editor supports all the standard features of ReadyAPI scripting editors such as property expansions, code validation, and code templates. Unlike in other editors, you can also debug your code in the Groovy script editor.

Groovy Script test step editor

Click the image to enlarge it.

To learn more about the test step, see Groovy Script Test Step.

Script objects

Below is a list of the default objects that are available in the Groovy Script test step:

Object Description
context Provides a scripting interface to the test case run.
log

Provides a scripting interface to the Script log (to view this log, click Logs in the bottom left corner of the ReadyAPI window and switch to the Script log tab).

You use this for debugging and logging purposes: to post and view data in the log.

testRunner Provides a scripting interface to the test runner object that is executing the current test case and test step. It exposes methods related to test execution and the underlying object model (via the testCase property).

You can see methods and properties of these objects on the Code Completion list. To invoke it, type the object name and press Ctrl+Space.

To learn more about an object, find it in the API docs. API docs describe the internal structure of ReadyAPI; however, the names of objects used in the scripting editors are not necessarily the same as the names in the internal structure of ReadyAPI. To find an object in the documentation, use the getClass() method that every object in ReadyAPI has:

Scripting editor: Get object class

Click the image to enlarge it.

Examples

Here are the links to examples of some scripts that can be run as part of the Groovy Script test step:

See Also

Script Editors
Groovy Script Test Step

Highlight search results