String (%STR) Macro
The String macro is used to insert arbitrary text data into the strings generated by a data source using the Custom String data generator.
The macro is an analogue of the String data generator.
Syntax
The macro has the following syntax:
%STR(MinLength, MaxLength, Digits, Letters, PunctuationMarks, Spaces)
Parameters
Examples
The following examples demonstrate how to use the String macro:
%STR(1, 8, True, true, TRUE, TrUe)
Generates strings of 1 – 8 characters that contain letters, digits, spaces, and punctuation marks.
%STR(4, 10, False, True, True, False)
Generates strings of 4 – 10 characters that contain letters and punctuation marks only. Each of the generated values will be repeated 3 times.
%STR(8, 3, True, True, True, True) <- Invalid value
The value of the
MinLength
parameter is greater than the value of the MaxLength parameter, so ReadyAPI will not parse the custom string.%STR(7, 7, True,,,True)
Generates strings of 7 characters that contain spaces and digits only.
%STR(1, True, False, True, False) <- Invalid value
The value of
MinLength
orMaxLength
is missing, so ReadyAPI will not parse the custom string.%STR(1, 10, False, False, False, False) <- Invalid value
There are no characters to generate a string, 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.