Generate realistic fake data for testing, development, and prototyping in Delphi applications
A comprehensive library for generating fake but realistic data in Delphi applications. Perfect for unit testing, database seeding, API testing, demos, and any scenario where you need convincing sample data.
Fake data (also known as synthetic data or mock data) is artificially generated information that mimics real-world data patterns without containing actual sensitive information. It's an essential tool in modern software development.
- π Privacy & Security: Test with realistic data without exposing real user information
- π Development Speed: Quickly populate databases and test scenarios without waiting for real data
- π§ͺ Comprehensive Testing: Create edge cases and specific scenarios that might not exist in production
- π Demos & Prototypes: Impress clients with realistic-looking applications
- β‘ Load Testing: Generate thousands of records for performance testing
- π Reproducible Tests: Create consistent test scenarios across different environments
- GDPR Compliance: Avoid privacy violations by using fake data for development
- Database Seeding: Don't copy production data to development environments
- Unit Testing: Tests should be predictable and not depend on external data
- Presentations: Avoid showing real customer information in demos
Scenario | How Delphi Fake Data Utils Helps |
---|---|
Unit Testing | Generate predictable test data for your business logic |
Database Seeding | Populate development databases with realistic records |
API Testing | Create varied payloads for REST/GraphQL endpoint testing |
Load Testing | Generate thousands of records to test performance |
DelphiMVCFramework | Perfect companion for testing web APIs and services |
UI Prototyping | Fill grids, lists, and forms with convincing sample data |
Client Demos | Show realistic applications without real customer data |
Data Migration Testing | Test import/export processes with controlled datasets |
- Download the repository
- Add
RandomUtilsU.pas
to your project - Add
RandomUtilsU
to your uses clause
uses
RandomUtilsU;
program QuickExample;
uses
System.SysUtils, RandomUtilsU;
begin
// Generate a random person
Writeln('Name: ' + GetRndFullName);
Writeln('Email: ' + GetRndEMailAddress);
Writeln('Country: ' + GetRndCountry);
Writeln('Salary: $' + FloatToStr(GetRndInteger(30000, 120000)));
ReadLn;
end.
Output:
Name: Marco Ferrari
Email: [email protected]
Country: italy
Salary: $75000
Generate location-specific data for different countries:
// Italian data
WriteLn(GetRndFullName(lcIT)); // "Giuseppe Rossi"
WriteLn(GetRndEMailAddress(lcIT)); // "[email protected]"
WriteLn(GetRndPhoneNumber(lcIT)); // "+39 345 678 9012"
WriteLn(GetRndAddress(lcIT)); // "Via Roma 123, 00100 Roma"
// US data
WriteLn(GetRndFullName(lcUS)); // "John Smith"
WriteLn(GetRndEMailAddress(lcUS)); // "[email protected]"
WriteLn(GetRndPhoneNumber(lcUS)); // "+1 (555) 123-4567"
WriteLn(GetRndAddress(lcUS)); // "Main Street 456, 12345 New York"
Supported Locales: lcIT
(Italian), lcUS
(US English), lcUK
(UK English), lcDE
(German), lcFR
(French)
Create realistic business scenarios:
// Company data
Company := GetRndCompanyName; // "TechSolutions"
Industry := GetRndIndustry; // "Information Technology"
Website := GetRndURL; // "https://www.techpro123.com"
// Employee data
JobTitle := GetRndJobTitle; // "Software Developer"
Salary := GetRndSalary(25000, 150000); // Context-aware salary ranges
PhoneNumber := GetRndPhoneNumber(lcUS); // "+1 (555) 987-6543"
Perfect for testing online stores and inventory systems:
// Product information
ProductName := GetRndProductName; // "UltraTech Pro"
Category := GetRndProductCategory; // "Electronics"
SKU := GetRndSKU; // "AB-1234-CD"
Price := GetRndPrice(9.99, 999.99); // 299.99
Color := GetRndColor; // "Blue"
ColorHex := GetRndColorHex; // "#0000FF"
Description := GetRndPhrase(10, 30); // "Innovative solution for modern..."
Generate networking and technical information:
// Network data
PublicIP := GetRndIPAddress(False); // "203.45.67.89"
LocalIP := GetRndIPAddress(True); // "192.168.1.100"
MacAddress := GetRndMacAddress; // "AA:BB:CC:DD:EE:FF"
URL := GetRndURL; // "https://www.example123.com"
// Secure URLs
SecureURL := GetRndURL('myapi.com', True); // "https://myapi.com"
Generate fake financial data for payment testing:
// β οΈ WARNING: These are FAKE numbers for testing only!
CreditCard := GetRndCreditCardNumber('VISA'); // "4123-4567-8901-2345"
IBAN := GetRndIBAN('IT'); // "IT85 X 1234 5678 123456789012"
BankAccount := GetRndBankAccount; // "1234-5678-9012-3456"
// Validate fake data
if IsValidFakeEmail('[email protected]') then
WriteLn('Email format is valid');
var
Person: TPerson;
begin
Person := TPerson.Create;
try
Person.ID := 1;
Person.Name := GetRndFirstName(lcIT);
Person.Surname := GetRndLastName(lcIT);
Person.EMail := GetRndEMailAddress(Person.Name, Person.Surname, lcIT);
Person.JobTitle := GetRndJobTitle;
Person.Salary := GetRndSalary(30000, 120000);
Person.Address := GetRndAddress(lcIT);
Person.PhoneNumber := GetRndPhoneNumber(lcIT);
Person.DOB := GetRndDate(1970, 35); // Age between 35-70
// Use the person object...
ShowMessage(Format('%s %s works as %s', [
Person.Name, Person.Surname, Person.JobTitle
]));
finally
Person.Free;
end;
end;
Generate complete datasets for testing:
{$IF Defined(GENERATE_DATASETS)}
var
PeopleDataSet: TDataSet;
begin
// Generate 100 Italian people
PeopleDataSet := GetPeople(100, lcIT);
try
// Use with database components, grids, etc.
DataSource1.DataSet := PeopleDataSet;
finally
PeopleDataSet.Free;
end;
end;
{$ENDIF}
Available Datasets:
GetPeople(Count, Locale)
- Complete person recordsGetCompanies(Count, Locale)
- Company informationGetProducts(Count)
- Product catalogGetEmployees(Count, Locale)
- Employee recordsGetPosts(Count)
- Blog posts/articles
Create realistic content:
// Different phrase lengths
ShortTitle := GetRndPhrase(3, 8); // "Innovative Tech Solutions."
Description := GetRndPhrase(15, 30); // "Advanced system for modern..."
LongContent := GetRndPhrase(50, 100); // Full paragraph
// Individual words
RandomWord := GetRndWord; // "innovative"
Perfect companion for testing MVCFramework applications:
// In your MVCFramework controller tests
procedure TTestUserController.TestCreateUser;
var
UserData: TJSONObject;
Response: TMVCResponse;
begin
// Create realistic test data
UserData := TJSONObject.Create;
try
UserData.AddPair('name', GetRndFirstName(lcUS));
UserData.AddPair('surname', GetRndLastName(lcUS));
UserData.AddPair('email', GetRndEMailAddress(lcUS));
UserData.AddPair('phone', GetRndPhoneNumber(lcUS));
UserData.AddPair('salary', TJSONNumber.Create(GetRndSalary(40000, 120000)));
// Test your API endpoint
Response := PostJSON('/api/users', UserData);
Assert.AreEqual(201, Response.StatusCode);
finally
UserData.Free;
end;
end;
The library is optimized for high performance:
var
StartTime: TDateTime;
I: Integer;
begin
StartTime := Now;
// Generate 10,000 names
for I := 1 to 10000 do
GetRndFullName(lcIT);
WriteLn(Format('Generated 10,000 names in %.3f seconds', [
(Now - StartTime) * 24 * 60 * 60
]));
// Typical output: ~0.05 seconds
end;
Built-in validators for generated data:
// Validate generated data
Email := GetRndEMailAddress;
if IsValidFakeEmail(Email) then
WriteLn('Email is properly formatted');
IBAN := GetRndIBAN('IT');
if IsValidFakeIBAN(IBAN) then
WriteLn('IBAN format is correct');
Phone := GetRndPhoneNumber(lcIT);
if IsValidFakePhoneNumber(Phone, lcIT) then
WriteLn('Phone number format is valid');
Function | Description | Example |
---|---|---|
GetRndFirstName(Locale?) |
Random first name | "Marco" |
GetRndLastName(Locale?) |
Random last name | "Rossi" |
GetRndFullName(Locale?) |
Full name | "Marco Rossi" |
GetRndEMailAddress(...) |
Email address | "[email protected]" |
GetRndPhoneNumber(Locale) |
Phone number | "+39 345 678 9012" |
GetRndAddress(Locale?) |
Full address | "Via Roma 123, 00100 Roma" |
GetRndDate(...) |
Random date | Various overloads |
GetRndInteger(Min, Max) |
Random integer | 42 |
GetRndFloat(Min, Max) |
Random float | 123.45 |
Function | Description | Example |
---|---|---|
GetRndCompanyName |
Company name | "TechSolutions" |
GetRndIndustry |
Industry type | "Information Technology" |
GetRndJobTitle |
Job title | "Software Developer" |
GetRndSalary(Min, Max) |
Salary amount | 75000 |
Function | Description | Example |
---|---|---|
GetRndProductName |
Product name | "UltraTech Pro" |
GetRndProductCategory |
Category | "Electronics" |
GetRndSKU |
SKU code | "AB-1234-CD" |
GetRndPrice(Min, Max) |
Price | 299.99 |
GetRndColor |
Color name | "Blue" |
GetRndColorHex |
Hex color | "#0000FF" |
Function | Description | Example |
---|---|---|
GetRndIPAddress(Local?) |
IP address | "192.168.1.100" |
GetRndMacAddress |
MAC address | "AA:BB:CC:DD:EE:FF" |
GetRndURL(...) |
Website URL | "https://example.com" |
Function | Description | Example |
---|---|---|
GetRndCreditCardNumber(Type) |
Credit card | "4123-4567-8901-2345" |
GetRndIBAN(Country) |
IBAN | "IT85 X 1234 5678..." |
GetRndBankAccount |
Bank account | "1234-5678-9012-3456" |
Function | Description |
---|---|
IsValidFakeEmail(Email) |
Validate email format |
IsValidFakeIBAN(IBAN) |
Validate IBAN format |
IsValidFakeCreditCard(Card) |
Validate card format |
IsValidFakePhoneNumber(Phone, Locale) |
Validate phone format |
- Delphi XE2+ (tested up to Delphi 12)
- Windows (Win32/Win64)
- FireDAC (for dataset generation, optional)
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Clone the repository
- Open in Delphi XE2 or newer
- Compile and run the sample projects
- Run tests to ensure everything works
- Additional locales (Spanish, Portuguese, etc.)
- More business domains (healthcare, finance, etc.)
- Performance optimizations
- Additional validators
- Documentation improvements
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
- Daniele Teti - Original creator and maintainer
- DMVCFramework Team - Ongoing support and development
- Contributors and users who provided feedback and improvements
- GitHub Issues: Report bugs or request features
- Website: https://www.danieleteti.it
- DelphiMVCFramework: https://github.com/danieleteti/delphimvcframework
β Star this project if you find it useful! It helps others discover this tool.
π’ Share your use cases - we love to hear how you're using Delphi Fake Data Utils in your projects!