Integer (%INT) Macro

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

The Integer macro is used to insert integer numbers into the strings generated by a data source using the Custom String data generator.

The macro is an analog of the Integer data generator.

Syntax

The macro has the following syntax:

%INT(MinValue, MaxValue, GenerationMode, Increment)

Parameters

MinValue and MaxValue

Specify the lower and upper bounds of integer numbers to be generated.

Note: The value of the MaxValue parameter must be greater than or equal to the value of the MinValue parameter. Also, MaxValue must be lower than or equal to 2147483646, and MinValue must be greater than or equal to -2147483648. Default values: MinValue = 1 and MaxValue = 2147483646.

GenerationMode

Specifies the generation mode.

  • True – Default. In this case, ReadyAPI uses the sequential generation mode and generates a sequence of values that will start from the value of the MinValue parameter. The increment value of the sequence is specified by the Increment parameter.

  • False – In this case, ReadyAPI uses random generation mode and generates random integer number values within the specified range.

The parameter is case-insensitive. ReadyAPI considers any string (even a string without symbols) as the False value.
The percent (%) and closing parenthesis symbols are service symbols, so avoid using them while specifying the parameter. Otherwise, it causes errors.

Increment

Specifies an increment value for the generated sequence. The default value of the parameter is 1.

Note: If you want to generate a descending sequence, you need to specify a negative value for this parameter.
This parameter is used only with the sequential generation mode, but you have to specify the parameter even if you use the Random generation mode.

Examples

The following example demonstrates how to use the Integer macro:

  • %INT(1, 10000, true, 20)

    Example: Integer macro in Data Generator

    Click the image to enlarge it.

    Generates a sequence of values starting from 1 with the increment value of 20.

  • %INT(1, 10000, true, -50)

    Generates a sequence of values starting from 10000 with the increment value of -50.

  • %INT(1, 10000,, 15)

    Generates a random collection of values from 1 to 10000. In this case, the value of the Increment parameter (15) is omitted.

  • %INT(1, 10000, -3)

    The GenerationMode parameter is missing, so ReadyAPI will not parse the custom string.

  • %INT(1, 10000, true)

    The Increment parameter is missing, so ReadyAPI will not parse the custom string.

Remarks

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

Integer Generator
Custom String Generator
Macro Reference

Highlight search results