Value From a Set (%SET) Macro

Applies to ReadyAPI 3.51, last modified on March 21, 2024

The Value From a Set macro is used to insert arbitrary values into the strings generated by a data source using the Custom String data generator. To specify values that will be used to generate data, you can either specify a list of items manually or load it from a text file.

The macro is an analog of the Value from a Set data generator.


The macro has the following syntax:

%SET(Value1, Value2, Value3, ..., LastValue, GenerationMode)


Value1, Value2, Value3, ..., LastValue

The values to be included in the resulting list.


Specifies the generation mode.

  • True – In this case, ReadyAPI uses a sequential generation mode and generates a sequence of values in the same order in which they are specified in the macro parameters or in the file.

  • False – Default. In this case, ReadyAPI uses a random generation mode and places the specified values in the resulting collection in a random order.

The parameter is case-insensitive.


The following examples demonstrate how to use the Value From a Set macro:

  • %SET(John Smith, Kate Robson, Susan O'Neil, false)

    Example: Value From a Set macro in Data Generator

    Click the image to enlarge it.

    Generates a string containing a random name  – John Smith, Kate Robson or Susan O'Neil. ReadyAPI uses commas as delimiters. If a value includes spaces, there is no need to enclose this value in quotes.

  • %SET(Plum, Pear, Pineapple, true)

    Generates a sequence of fruit names.


For more information on adding macros to custom strings, see About Custom String Generator.

For more information on general rules used for specifying macro parameters, see Custom String Generator Rules.

See Also

Value From a Set Generator
Custom String Generator
Macro Reference

Highlight search results