Sometimes, the functionality of pre-installed libraries might prove to be insufficient for your needs. In this case, you can load an external Java library and use classes from it. You can write and compile a library yourself or use a third-party one.
Loading external libraries
To use an external Java library in ReadyAPI:
-
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.
-
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:
Groovy
import Sample // Import the Sample class
Sample.add(1, 2) // Use the add method from the Sample class