Value From a Set (%SET) Macro

Applies to TestComplete 14.91, last modified on July 20, 2021

Description

The Value From a Set macro is used to insert arbitrary values into custom strings generated with the Custom String 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 textual file (see below).

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

Syntax

The macro has the following syntax:

%SET(Value1, Value2, Value3, ..., LastValue, *SEQ|*RND, *xN)

– or –

%SET(*FILE: File_Name, *SEQ|*RND, *xN)

Parameters

Value1, Value2, Value3, ..., LastValue

The values to be included in the resulting list.

*FILE: File_Name

Specifies the textual file that will be used to load values to generate data from.

To load values from a file, the file must contain one value per line.

*SEQ or *RND

Optional parameter. Specifies the generation mode:

  • *SEQ (or *Sequential) - Default. If this mode is used, TestComplete generates a sequence of values in the same order in which they are specified in the macro parameters or in the file.
  • *RND (or *Random) - If this mode is used, TestComplete places the specified values in the resulting collection in a random order.

*xN

Optional parameter. Specifies the number of possible repetitions of each value in series of generated strings. N is a positive number that specifies the number of repetitions: 1, 2, 3, and so on. The default parameter value is *x1 (no repetitions).

Examples

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

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

    Generates a random sequence of names - John Smith, Kate Robson and Susan O'Neil. TestComplete uses commas as delimiters. If a value includes spaces, there is no need to enclose this value in quotes.

  • %SET(Plum, Pear, Pineapple, *Sequential)

    Generates a sequence of fruit names.

  • %SET(*FILE: C:\My Values.txt, *SEQ)

    Loads a set of values from the specified file and adds them one by one to the generated sequence.

    Note that if the file name includes spaces, there is no need to enclose the name in quotes.

  • %SET(Boston, Austin, Miami, *Random, *x4)

    Generates a random sequence of city names - Boston, Austin, Miami - and repeats each name 4 times.

Remarks

See Also

Macro Reference
Custom String Generator Rules
Custom String Generator
Value from a Set Generator
Using Data Generators
Generate Data Dialog

Highlight search results