Response Templating - Random Values

MockLab provides two random value helpers - randomValue and pickRandom.

Random value

The randomValue helper generates random strings of a specific type and length. Optionally, values containing alphabetic characters can be made upper case via the uppercase parameter.

{{randomValue length=33 type='ALPHANUMERIC'}}

{{randomValue length=12 type='ALPHANUMERIC' uppercase=true}}

{{randomValue length=55 type='ALPHABETIC'}}

{{randomValue length=27 type='ALPHABETIC' uppercase=true}}

{{randomValue length=10 type='NUMERIC'}}

{{randomValue length=5 type='ALPHANUMERIC_AND_SYMBOLS'}}

{{randomValue type='UUID'}}

Pick random

The pickRandom helper randomly selects a value from its parameters.

If the first parameter is a collection then the value will be randomly selected from within this:

// Assume that numberList = [1, 2, 3]

{{pickRandom numberList}} // One of 1, 2 or 3

Otherwise a value will be picked from the list of parameters provided:

{{pickRandom '1' '2' '3'}} // One of 1, 2 or 3