
Random Test Data Generator Tutorial Part 2: Master Field Configuration and Data Constraints
Advanced guide to customizing test data fields, setting constraints, and creating complex datasets. Learn about field types, validation rules, and custom formats.
Random Test Data Generator Tutorial Part 2: Advanced Field Configuration and Customization
Welcome to Part 2 of our Random Test Data Generator tutorial series! Now that you understand the basics, we'll explore the powerful customization features that make this tool professional-grade.
Prerequisites
- Completed Part 1 of this tutorial series
- Basic understanding of data types and validation
- Familiarity with date formats and regular expressions (helpful but not required)
Objectives
By the end of Part 2, you'll master:
- Field configuration and constraint settings
- Custom format patterns
- Advanced field types and categories
- Field ordering and visibility controls
- Locale-specific data generation
Step 1: Understanding Field Categories
The tool organizes fields into 18 categories. Here are few of them listed below. However, you can find all of them right inside the UI.
Core Categories
- Personal: Names, emails, phone numbers, job titles, avatar, gender, date of birth
- Address: Street addresses, cities, postal codes, coordinates, timezone
- Commerce: Products, prices, departments, materials, adjective, product description
- Company: Business names, catch phrases, identifiers, business id
- Finance: Account numbers, credit cards, currency codes, bitcoin address, amount, routing number
Specialized Categories
- Internet: URLs, usernames, passwords, IP addresses, mac address, user agent, domain name
- Date: Past/future dates, weekdays, months, anytime
- Lorem: Text generation for content words, paragraph, slug
- Database: UUIDs, MongoDB IDs, database types, Nano id, database engine
- Science: Chemical elements, formulas, DNA sequences, coordinates
Step 2: Field Management Operations
Adding Multiple Fields
Reordering Fields
- Use up/down arrows to change field order (in case you want to see the output in any specific order)
- Order determines column sequence in output
Field Visibility
- Eye icon toggles field visibility
- Hidden fields remain configured but don't appear in output
- Useful for temporarily excluding fields
Step 3: Field Configuration Deep Dive
Number Fields Configuration
Fields: Price, Amount, Integer, Float, Latitude, Longitude
Available Constraints:
- Minimum Value: Set lower bound (e.g., 0 for positive numbers)
- Maximum Value: Set upper bound (e.g., 1000 for reasonable prices)
- Decimal Precision: Control decimal places (0-10)
Example: Lets configure a dataset with id, name and salary field where salary is:
- Min: 30000
- Max: 200000
- Decimal Precision: 1
!Field configuration dialog showing number constraints
Date Fields Configuration
Fields: Birth Date, Past Date, Future Date, Recent Date
Available Constraints:
- Start Date: Earliest possible date
- End Date: Latest possible date
- Date Format: Output format options
Format Options:
YYYY-MM-DD
: 2024-01-15
MM/DD/YYYY
: 01/15/2024
DD/MM/YYYY
: 15/01/2024
MMMM DD, YYYY
: January 15, 2024
!Date field configuration with format options
Text Fields Configuration
Fields: Lorem Words, Sentences, Paragraphs, Bio
Available Constraints:
- Number of Words: For word generation (1-20)
- Min/Max Length: Character count limits
- Min/Max Paragraphs: For paragraph generation
Password Fields Configuration
Available Constraints:
- Length: Min/max character count
- Character Sets:
- Uppercase letters (A-Z)
- Lowercase letters (a-z)
- Numbers (0-9)
- Symbols (!@#$%^&*)
Example: You can create a corporate password based on the policy as needed
- Min Length: 12
- Max Length: 16
- Include all character sets
Step 4: Custom Format Patterns
Custom formats transform generated data using patterns. In case, you would like to read the detailed documentation on custom formatting, click here:
Pattern Syntax
#
: Random digit (0-9)
{value}
: Original generated value
Common Examples
- Employee ID:
EMP-####
→EMP-1234
- Product Code:
PROD-{value}-##
→PROD-Laptop-42
- Phone Format:
+1-###-###-####
→+1-555-123-4567
Advanced Patterns
- Serial Number:
SN{value}####
- Reference Code:
REF-##-{value}-##
- Custom ID:
{value}-####-COMP
!Custom format pattern examples
Step 5: Locale-Specific Generation
Supported Locales
The tool supports 20+ locales with region-specific formatting:
English Variants:
- United States (en_US)
- United Kingdom (en_GB)
- Canada (en_CA)
- Australia (en_AU)
European:
- Germany (de) - German names, postcodes
- France (fr) - French names, phone formats
- Spain (es), Italy (it), Netherlands (nl)
Asian:
- Japan (ja) - Japanese names, postal codes
- China (zh_CN), Korea (ko), India (en_IN)
Locale Impact Examples
Phone Numbers:
- US: +1 (555) 123-4567
- UK: +44 1234 567890
- Germany: +49 123 4567890
- Japan: 03-1234-5678
Postal Codes:
- US: 90210
- UK: SW1A 1AA
- Germany: 10115
- Canada: K1A 0A6
Step 6: Complex Field Combinations
Customer Profile Example
- first_name, last_name (US locale)
- email (derived from names)
- phone (US format)
- date_of_birth (1950-2000 range)
- street_address, city, state, zip_code
- All constrained to US format
- customer_id (Custom format:
CUST-######
)- account_balance (Min: 0, Max: 50000, 2 decimals)
- registration_date (Past 5 years)
Step 7: Validation and Testing
Field Validation
- Test constraints with small datasets first
- Verify custom formats produce expected patterns
- Check locale-specific formatting
Common Issues and Solutions
- Date ranges: Ensure start_date < end_date
- Number ranges: Verify min < max values
- Custom formats: Test patterns with sample data
- Text length: Balance min/max for realistic content
Practice Exercise
Try creating a realistic employee dataset with these fields:
EMP-####
)Summary
In Part 2, you mastered:
- Advanced field configuration options
- Constraint settings for different data types
- Custom format patterns for professional data
- Locale-specific data generation
- Complex field combinations and validation
Next Up: In Part 3, we'll explore export workflows, integration strategies, and professional use cases for maximum productivity.
---