Pre-installed Script Libraries

ReadyAPI is shipped with a number of Java and Groovy libraries that you can use in your scripts right away. Some of the libraries are imported in all the editors by default; others have to be imported first.

Libraries imported by default

A number of basic Java and Groovy classes are imported by default in all the scripting editors in ReadyAPI. They are ready to be used at all times. These are:

  • java.io.*

  • java.lang.*

  • java.math.BigDecimal

  • java.math.BigInteger

  • java.net.*

  • java.util.*

  • groovy.lang.*

  • groovy.util.*

Libraries ready for import

There are more libraries that are shipped with ReadyAPI but not imported to the scripting editors by default. You can import them by using the import <library> command. Here are some of the libraries:

  • java.nio.* – Used for low-level I/O operations.

  • javax.jms.* – A common way to work with JMS.

  • groovy.json.* – Used for parsing and generating JSONs.

  • groovy.xml.* – Used for parsing and generating XMLs.

  • groovy.sql.* – Used for working with JDBC.

  • org.apache.activemq.* – Used for actions with ActiveMQ JMS.

  • org.apache.commons.* – Contains many reusable Java components.

  • org.apache.http.* – Used for working with HTTP.

Here is a simple example of a script that uses ready-for-import libraries to copy a file. You can run it in the Groovy Script test step editor:

See Also

Publication date: