Generate Random Identifier

Applies to ReadyAPI 3.5, last modified on January 19, 2021

You can use a Groovy script to generate random values and use them to enhance your tests.

This topic describes how to generate random IDs with the Universally Unique Identifier (UUID) feature.

Where To Use

You can use this script anywhere in ReadyAPI.

Examples

  • The following code demonstrates how to generate a UUID and use it as a variable:

    Groovy

    // Generating a random variable value.
    def var = UUID.randomUUID()

    // Logging the variable.
    log.info var
  • The following code demonstrates how to generate a UUID in a string:

    Groovy

    // Generating a random item identifier.
    log.info "Item: ${java.util.UUID.randomUUID()}"

See Also

Groovy Scripts
Scripting

Highlight search results