ACCELQ provides a powerful "Get Random Data" command that enables testers to generate various types of random data for test automation. This guide covers common use cases and examples for different data types.
Basic Syntax
Command: Get Random Data
Statement: Get random [info type] [additional parameters based on type]
Data Types and Examples
1. Text Generation
Alphabetic Text
Get random text (alphabetic) with fixed length 8
// Example output: "ktlmnpqr"
Get random text (alphabetic) with range length between 5 and 10
// Example output: "jklmnp"
Alphanumeric Text
Get random text (alphanumeric) with prefix "TEST_" and suffix "_QA"
// Example output: "TEST_A12B3C_QA"
Numeric Text
Get random text (numeric) with fixed length 6
// Example output: "847295"
2. Date Generation
Using Absolute Dates
Get random date between given dates of '01/01/2023' and '12/31/2023'
Format: MM/dd/yyyy
// Example output: "07/15/2023"
Using Relative Dates (Offsets)
// Future Date
Get random date with offset unit days between 1 and 30 from current date. Format: MM/dd/yyyy
// If today is 12/28/2024, example output: "01/15/2025"
// Past Date
Get random date with offset unit months between -12 and -1 from current date. Format: MM/dd/yyyy
// If today is 12/28/2024, example output: "05/28/2024"
You can get the date in any required format. You may either select one of the dropdown options for the format or build your own custom format following the syntax of Java Date format.
3. Numbers
Integer Numbers
Get random number (integer) between 1000 and 9999
// Example output: 5842
Get random number (integer) between -100 and 100
// Example output: -42
Decimal Numbers
Get random number (decimal) between 10.00 and 100.00 with precision 2
// Example output: 45.67
4. Personal Information
Names with Locale Support
Get random first name with locale 'en-US'
// Example output: "Michael"
Get random last name with locale 'en-GB'
// Example output: "Smith"
Email Addresses
Get random email address with prefix "test" and domain "company.com"
// Example output: "test.abc123@company.com"
5. Address Information
Location Data
Get random zip code with state abbreviation 'CA'
// Example output: "90210"
Get random street address with locale 'en-US'
// Example output: "1234 Oak Street"
6. Pattern Matching
Allows you to generate text matching a certain regular expression pattern.
Get random matching pattern "[A-Z]{3}-[0-9]{4}-[A-Z]{2}"
// Example output: "ABC-1234-XY"
Supported Information Types and Configuration Options
Info Type | Description | Available Options |
text (alphabetic) | Generates text containing only letters (A-Z, a-z) |
- Text length type (fixed/range) - Fixed length or min/max range - Prefix/suffix strings |
text (alphanumeric) | Generates text containing both letters and numbers |
- Text length type (fixed/range) - Fixed length or min/max range - Prefix/suffix strings |
text (numeric) | Generates text containing only numbers |
- Text length type (fixed/range) - Fixed length or min/max range - Prefix/suffix strings |
matching pattern | Generates text matching a specific regex pattern | - Regex pattern string |
number (integer) | Generates random whole numbers |
- Range type (inclusive/exclusive) - Min/max number range |
number (decimal) | Generates random decimal numbers |
- Range type (inclusive/exclusive) - Min/max number range - Decimal precision |
date | Generates random dates |
- Range type (given offsets/given dates) - Offset unit (days/months/years) - Min/max offset from current - Start/end date - Date format (MM/dd/yyyy, etc.) - Custom date format |
first name | Generates random first names | - Locale options |
last name | Generates random last names | - Locale options |
email address | Generates random email addresses |
- Email prefix - Email domain - Locale options |
prefix | Generates name prefixes (Mr., Mrs., etc.) | - Locale options |
phone number | Generates random phone numbers | - Locale options |
company name | Generates random company names | - Locale options |
zip code | Generates random zip/postal codes |
- State abbreviation - Locale options |
city | Generates random city names | - Locale options |
street name | Generates random street names | - Locale options |
street address | Generates complete street addresses | - Locale options |
state | Generates random state/province names | - Locale options |
state abbreviation | Generates random state/province codes | - Locale options |
URL | Generates random website URLs | - Locale options |
words | Generates random set of words | - Word count |
sentences | Generates random sentences | - Sentence count |
IP address | Generates random IPv4 addresses | |
credit card number | Generates random valid credit card numbers | |
SSN | Generates random Social Security Numbers | |
guid | Generates random GUIDs | |
hex color | Generates random hex color codes | |
isbn | Generates random valid ISBN numbers | |
password | Generates random passwords |
- Length - Include special chars - Include numbers |
boolean | Generates random true/false values | |
file name | Generates random file names | - Include extension |
mime type | Generates random MIME type strings | |
file extension | Generates random file extensions | |
currency code | Generates random currency codes | |
time zone | Generates random time zone identifiers | |
user name | Generates random usernames |
- Length range - Allow special chars |
country | Generates random country names | - Locale options |
country code | Generates random country codes | - Code type (2-char/3-char) |
For locale options, the available values include:
- default (follows location where the Agent is running)
- Language only (e.g., 'en', 'fr', 'de')
- Language-region (e.g., 'en-US', 'en-GB', 'fr-FR')
- Over 50 supported locales
Comments
0 comments
Please sign in to leave a comment.