Nexial Automation

Test Automation Platform for everyone!

X

$(random)

Description

This built-in Nexial function renders a series of randomized text or number based characters, which can be useful as test data or to exploratory testing the AUT with less than expected input. The main objective behind this function is to provide just-in-time randomization so that the test execution, and by association the test result as well, could be less than predictable.

With regards to random numeric generation, note that this function renders characters not true numeric value. Hence, since the character 0 is a value numeric character, it is conceivable that this function could render  00201.005, as character but not resolving to the numeric value of 201.005. To convert the randomized character to a true number, consider the following strategy:

Available Functions

$(random|integer|length)

Render a random integer (whole number) with specified length

Example
Script

Output


$(random|numeric|from|to)

Render a random integer that is between from and to, inclusively. Comparing this to the previous function, this one generates an integer that is numerically between a from number and a to number. However  $(random|integer|length) generates a random number that has the same number of digits as the specified length.

Example
Script

Output


$(random|decimal|wholeAndFraction)

Render a random decimal number with specified length for the whole number portion and the fractional portion. The  wholeAndFraction is separated by comma (,). For example, $(random|decimal|5,3) would generate a random decimal number between 00000.000 and 99999.999

Example
Script

Output


$(random|letter|length)

Render a random alphabet-only string with specified length.

Example
Script

Output


$(random|alphanumeric|length)

Render a random string with alphabet or numeric characters, with specified length.

Example
Script

Output


$(random|any|length)

Render a random string with any character between ASCII 32 and 126 (inclusive), with specified length. The ASCII range is sometimes known as “space-to-tilde” range, or the  printable character range. See  here  for more details of the characters included. 

Example
Script

Output


$(random|characters|input|length)

Render a random string based on the specified input and the  specified length. This can be particularly useful to validate functionality with specified characteristics on input characters, such as password. For example, $(random|characters|abcdefghijklmnopqrstuvwxyz!@#$%^*()|8) will render 8 characters randomly from the  abcdefghijklmnopqrstuvwxyz!@#$%^*() range.

Example
Script

Output


See Also