Custom String Generation Rules

Applies to ReadyAPI 3.5, last modified on December 29, 2020

Basic Concepts

To describe the format of text data that the custom string generator produces, you need to use a string containing a combination of special macros, string literals and regular expressions. Below is a sample formatting string that can be specified in the generator parameters:

Sample Custom String

This sample string contains the following parts:

  • Macros. The macro names start with the % characters and typically have parentheses. Macros generate data of the needed data type and insert it into the resulting string. Macros can have parameters. For more information about macros, see below.

  • String literals. You can use them to specify symbols that should be literally included into the resulting string.

Show Examples

Characters That Need Special Handling

When you specify the custom string (not macro parameters), ReadyAPI considers the symbols of percent % and opening parenthesis ( as service symbols. If your custom string contains these symbols, you have to put the percent symbol before them. For example, you need to type %% to specify the percent symbol and %( to specify the opening parenthesis.

When you specify the macro parameters, ReadyAPI considers the percent and closing parenthesis symbols as service symbols. Avoid using them, otherwise ReadyAPI cannot parse a custom string.

Macros

You can use macros to insert generated data of various types into the string that the custom string generator produces.

Writing Macro Names

Macro names are case-insensitive and match the appropriate generators, for instance:

For information on available macro names, see macro descriptions.

Writing Macro Parameters

Some macros require parameters. They are specified in parentheses. If the macro has no parameters, you can also skip the parentheses.

The parameters must be written in the specified order and separated by commas. The spaces between parameters are ignored.

When you specify the macro parameters, ReadyAPI considers the percent (%) and closing parenthesis ( ) ) symbols as service symbols. Avoid using them, otherwise ReadyAPI cannot parse a custom string.

The parameter values correspond to the values that you see in the setting of the corresponding generator. For instance, the Computer Address generator has the Address type parameter that can accept either the IPv4, or Mac48 value. You can use these values for the %COMP macro in the custom string generator settings.

Some parameters are case-insensitive (for example, any True or False parameter), but some are not. For detailed information on macro parameters, see macro descriptions.

See Also

Macro Reference
Custom String Generator
String Generator

Highlight search results