Applies to ReadyAPI 3.4, last modified on October 14, 2020

ReadyAPI allows you to enhance your projects and tests with scripts. Scripts are available across ReadyAPI and can happen in many different cases:

Most commonly, scripts are used to prepare your environment before running a test, and remove any aftereffects of the test when it finishes. For example, you can start virtual services before starting your test, and stop them once the testing is over.

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

Supported languages

You can select the scripting language to be used in the project properties. We recommend using Groovy scripts in your tests, since ReadyAPI offers code completion and debugging of Groovy scripts.

Currently, ReadyAPI supports the following languages:

 Groovy 2.4.17
 Rhino JavaScript 1.7.10

External Java libraries

ReadyAPI can load external libraries and work with classes from them. For this:

  1. Place your .jar to the <ReadyAPI>\bin\ext folder. The next time you start ReadyAPI, it will load the file as an external Java library that can be called from your scripts.

    If you address an external library in a virtual service that will be run in VirtServer, place the library in the <VirtServer>\bin\ext folder.

    If you address an external library in a load test that will be run on a LoadUI agent, place the library in the <LoadAgent>\bin\ext folder.

  2. Import the class to your script and call the method you need. Here is an example of using a simple class from the imported .jar file:


    import Sample // Import the Sample class

    Sample.add(1, 2) // Use the add method from the Sample class

Common scripting tasks

Here are some common ways to improve tests by using scripts:

See Also

Groovy Script Test Step
Virtual Service Scripting
Script Libraries

Highlight search results