Generate Random Identifier

Applies to ReadyAPI 3.56, last modified on November 21, 2024

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

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

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

    Groovy

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

See Also

Groovy Scripting Samples
Scripting

Highlight search results