Sorry, we didn't find any relevant articles for you.

Send us your queries using the form below and we will get back to you with a solution.

How do I use the RandomStringGen?

Generate random string in letter, numbers, alpha numberic, or ASCII

Description

The RandomStringGen generates a random string based on the lengths passed. The string can be letters, numbers, alphanumeric characters, or ASCII characters. It can generate unique, unpredictable, or non-sequential string values.

Use Case Examples

Some sample use cases include:

  1. Creating Random Identifiers or Codes - Create random reference codes, user IDs, promo codes, or voucher numbers.
    • Example - UserX8h2Y, PROMO670837, REF90231
  2. Populating Placeholder Text Fields - Fill text fields with random characters to test UI validation, form field limitations, etc.
    • Example - Filling a notes field with random strings to test character limits
  3. Testing Field Validation Rules - Validate that a system can handle random, unexpected string inputs, such as special characters or variable-length strings.
    • Example - Test boundary conditions or invalid characters.

Generator Parameters

Items with an asterisk * are required.

  • length* - Defines the length of a random string.
  • stringType* - Defines how the given value can be modified (letters, numbers, lettersAndNumbers, specialCharacters, ASCIICharacters, or allCharacters).
  • caseType* - Defines the ways in which the given value may be modified (All, CaptialCase, UpperCase, or LowerCase).
  • seed - Using the seed will ensure that the same random data is generated each time data is generated.
  • unique -Defines whether unique string combinations will be generated. The default value is 'false,' meaning that the same value can be generated more than once.
  • include - Defines which characters must be included in the generation. It will also override the stringType selection.
  • exclude - Defines which characters will be excluded from generation.

Example 1 - Generate a Random String of 15 Characters

In this example, the generated strings will contain numbers and letters (uppercase and lowercase).

Generator Configuration

The following generator parameters have been set:

  • length = 15
  • stringType = lettersAndNumbers
  • caseType = All
  • unique = True

Example 2 - Generate a Promo Code with 6 Random Numbers

This example generates the Value shown below:

Linked Generators

Three Generators are used to generate the desired test data:

  • ConstantGen - Generates "PROMO"
  • RandomStringGen - Generates random, unique 6-digit number
  • ConcatGen - Combines PROMO with the 6-digit number

ConstantGen

Generates "PROMO" for the code.

RandomStringGen

Generates a random, unique six-digit number. The following parameters have been configured:

  • length = 6
  • stringType = numbers
  • unique = true

ConcatGen

References the other two Generators to concatenate the values:

Example 3 - Random String Including Specified Characters

You may input the characters you'd like to use in the include text box to build a random string. When values exist in the exclude parameter, this will override the selected stringType. For this example, the string should include these values:

  • Numbers - 0123456789
  • Letters - ABGHXY (Uppercase)
  • Symbols - #$@&

Sample Output

The following output will be generated in this example:

Generator Configuration

The following generator parameters have been configured:

  • length = 10
  • caseType = Uppercase
  • include = 0123456789ABGHXY#$@&

Example 4 - 10 Digit String Containing Only Even Numbers

This example will generate a string of 10 numbers. All numbers in the string will be even.

Sample Output

The following output will be generated in this example:

Generator Configuration

The following generator parameters have been configured:

  • length =10
  • caseType = numbers
  • exclude = 13579