Faker Reference for Mockarty
Table of Contents
- Faker Overview
- Basic Data Types
- Identifiers
- Personal Data
- Dates and Time
- Numeric Data
- Addresses and Locations
- Internet and Communication
- Business Data
- Localized Data
- Special Functions
Faker Overview
What is Faker?
Faker in Mockarty is a random test data generation system integrated with JsonPath for creating dynamic responses.
Key features:
- Random data - generation of realistic test data
- Localization - support for various languages and regions
- Typing - specialized generators for different data types
- Reproducibility - ability to control randomness
Usage Syntax
{
"response": {
"payload": {
"id": "$.fake.UUID",
"name": "$.fake.FirstName",
"email": "$.fake.Email",
"createdAt": "$.fake.RFC3339"
}
}
}
In Go Template syntax:
{
"id": "{{.fake.UUID}}",
"name": "{{.fake.FirstName}}",
"email": "{{.fake.Email}}"
}
Basic Data Types
Strings and Text
| Function | Description | Example |
|---|---|---|
$.fake.Word |
Random word | "lorem" |
$.fake.Sentence |
Sentence | "Lorem ipsum dolor sit amet." |
$.fake.Paragraph |
Text paragraph | "Lorem ipsum dolor sit amet..." |
$.fake.Letter |
Random letter | "A" |
$.fake.Character |
Random character | "x" |
Usage examples:
{
"response": {
"payload": {
"title": "$.fake.Sentence",
"description": "$.fake.Paragraph",
"keyword": "$.fake.Word",
"code": "$.fake.Character"
}
}
}
Boolean Values
| Function | Description | Example |
|---|---|---|
$.fake.Bool |
Random boolean value | true / false |
{
"response": {
"payload": {
"isActive": "$.fake.Bool",
"hasPermissions": "$.fake.Bool",
"emailVerified": "$.fake.Bool"
}
}
}
Identifiers
UUID and Unique IDs
| Function | Description | Example |
|---|---|---|
$.fake.UUID |
UUID v4 | "a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11" |
$.fake.UUIDDigit |
UUID digits only | "123456789012345678901234567890123456" |
$.fake.UUIDHyphenated |
UUID with hyphens | "550e8400-e29b-41d4-a716-446655440000" |
{
"response": {
"payload": {
"id": "$.fake.UUID",
"userId": "$.fake.UUIDDigit",
"sessionId": "$.fake.UUIDHyphenated",
"trackingId": "TRK-$.fake.UUIDDigit"
}
}
}
Numeric Identifiers
| Function | Description | Example |
|---|---|---|
$.fake.Int |
Random integer | 42 |
$.fake.PositiveInt |
Positive number | 123 |
$.fake.NegativeInt |
Negative number | -456 |
$.fake.IntBetween(min, max) |
Number in range | $.fake.IntBetween(1, 100) -> 75 |
{
"response": {
"payload": {
"id": "$.fake.PositiveInt",
"priority": "$.fake.IntBetween(1, 10)",
"score": "$.fake.IntBetween(-100, 100)",
"count": "$.fake.Int"
}
}
}
Personal Data
Names and Personal Information
| Function | Description | Example |
|---|---|---|
$.fake.FirstName |
First name | "John" |
$.fake.LastName |
Last name | "Doe" |
$.fake.Name |
Full name | "John Doe" |
$.fake.Username |
Username | "johnDoe123" |
$.fake.Gender |
Gender | "male" / "female" |
Localized names:
| Function | Description | Example |
|---|---|---|
$.fake.RussianFirstNameMale |
Russian male first name | "Aleksandr" |
$.fake.RussianFirstNameFemale |
Russian female first name | "Anna" |
$.fake.RussianLastNameMale |
Russian male last name | "Ivanov" |
$.fake.RussianLastNameFemale |
Russian female last name | "Ivanova" |
$.fake.ChineseFirstName |
Chinese first name | "Wei" |
$.fake.ChineseName |
Chinese full name | "Li Wei" |
$.fake.GermanFirstName |
German first name | "Hans" |
Examples:
{
"response": {
"payload": {
"user": {
"firstName": "$.fake.FirstName",
"lastName": "$.fake.LastName",
"fullName": "$.fake.Name",
"username": "$.fake.Username",
"gender": "$.fake.Gender"
},
"russianUser": {
"name": "$.fake.RussianFirstNameMale",
"surname": "$.fake.RussianLastNameMale"
}
}
}
}
Dates and Time
Date Generators
| Function | Description | Example |
|---|---|---|
$.fake.Date |
Random date | "1985-12-25" |
$.fake.RFC3339 |
RFC3339 timestamp | "2024-01-15T14:30:45Z" |
$.fake.UnixTime |
Unix timestamp | 1705315845 |
$.fake.FutureDate |
Future date | "2025-06-15" |
$.fake.PastDate |
Past date | "2023-03-10" |
$.fake.DateRange(start, end) |
Date in range | Custom range |
Time components:
| Function | Description | Example |
|---|---|---|
$.fake.Year |
Year | 2024 |
$.fake.Month |
Month | "March" |
$.fake.MonthShort |
Month abbreviated | "Mar" |
$.fake.Day |
Day | 15 |
$.fake.WeekDay |
Day of the week | "Monday" |
$.fake.WeekDayShort |
Day of the week abbreviated | "Mon" |
Examples:
{
"response": {
"payload": {
"createdAt": "$.fake.RFC3339",
"birthDate": "$.fake.PastDate",
"expiryDate": "$.fake.FutureDate",
"timestamp": "$.fake.UnixTime",
"dateComponents": {
"year": "$.fake.Year",
"month": "$.fake.Month",
"day": "$.fake.Day",
"weekday": "$.fake.WeekDay"
}
}
}
}
Numeric Data
Number Generators
| Function | Description | Example |
|---|---|---|
$.fake.Float64 |
Floating-point number | 123.456 |
$.fake.Float64(min, max) |
Float in range | $.fake.Float64(10.0, 100.0) |
$.fake.Price |
Price | 99.99 |
$.fake.Latitude |
Latitude | 40.7128 |
$.fake.Longitude |
Longitude | -74.0060 |
Mathematical functions:
| Function | Description | Example |
|---|---|---|
$.fake.Digit |
Single digit | 7 |
$.fake.RandomDigit |
Random digit | 3 |
$.fake.NumberBetween(min, max) |
Number between values | 75 |
Examples:
{
"response": {
"payload": {
"price": "$.fake.Price",
"weight": "$.fake.Float64(0.1, 999.9)",
"coordinates": {
"lat": "$.fake.Latitude",
"lng": "$.fake.Longitude"
},
"ratings": {
"overall": "$.fake.Float64(1.0, 5.0)",
"count": "$.fake.IntBetween(1, 1000)"
}
}
}
}
Addresses and Locations
Address Data
| Function | Description | Example |
|---|---|---|
$.fake.Address |
Full address | "123 Main St, New York, NY 10001" |
$.fake.Street |
Street name | "Main Street" |
$.fake.StreetAddress |
Street address | "123 Main St" |
$.fake.City |
City | "New York" |
$.fake.State |
State/region | "California" |
$.fake.StateAbbr |
State abbreviation | "CA" |
$.fake.Zip |
Postal code | "90210" |
$.fake.Country |
Country | "United States" |
$.fake.CountryAbbr |
Country code | "US" |
Examples:
{
"response": {
"payload": {
"shippingAddress": {
"street": "$.fake.StreetAddress",
"city": "$.fake.City",
"state": "$.fake.State",
"zip": "$.fake.Zip",
"country": "$.fake.Country"
},
"billingAddress": {
"fullAddress": "$.fake.Address",
"countryCode": "$.fake.CountryAbbr"
}
}
}
}
Internet and Communication
Internet Data
| Function | Description | Example |
|---|---|---|
$.fake.Email |
Email address | "john.doe@example.com" |
$.fake.SafeEmail |
Safe email | "user@example.org" |
$.fake.FreeEmail |
Free email | "user@gmail.com" |
$.fake.CompanyEmail |
Corporate email | "user@company.com" |
$.fake.URL |
URL address | "https://example.com/path" |
$.fake.DomainName |
Domain name | "example.com" |
$.fake.IPv4 |
IPv4 address | "192.168.1.1" |
$.fake.IPv6 |
IPv6 address | "2001:0db8:85a3::8a2e:0370:7334" |
$.fake.MacAddress |
MAC address | "00:1B:63:84:45:E6" |
$.fake.UserAgent |
User Agent | "Mozilla/5.0 (Windows NT 10.0; Win64; x64)..." |
Communication and Telephony
| Function | Description | Example |
|---|---|---|
$.fake.Phone |
Phone number | "+1-555-123-4567" |
$.fake.PhoneFormatted |
Formatted phone number | "(555) 123-4567" |
$.fake.TollFreePhone |
Toll-free number | "1-800-555-0199" |
Examples:
{
"response": {
"payload": {
"contact": {
"email": "$.fake.Email",
"phone": "$.fake.Phone",
"website": "$.fake.URL"
},
"technical": {
"ipAddress": "$.fake.IPv4",
"macAddress": "$.fake.MacAddress",
"userAgent": "$.fake.UserAgent"
}
}
}
}
Business Data
Corporate Information
| Function | Description | Example |
|---|---|---|
$.fake.Company |
Company name | "Acme Corporation" |
$.fake.CompanySlogan |
Company slogan | "Innovation at its best" |
$.fake.JobTitle |
Job title | "Senior Software Engineer" |
$.fake.Department |
Department | "Engineering" |
$.fake.Industry |
Industry | "Technology" |
Financial Data
| Function | Description | Example |
|---|---|---|
$.fake.CreditCard |
Credit card number | "4111111111111111" |
$.fake.CreditCardType |
Card type | "Visa" |
$.fake.Currency |
Currency code | "USD" |
$.fake.CurrencySymbol |
Currency symbol | "$" |
$.fake.BTC |
Bitcoin address | "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa" |
E-commerce Data
| Function | Description | Example |
|---|---|---|
$.fake.ProductName |
Product name | "Wireless Bluetooth Headphones" |
$.fake.ProductCategory |
Product category | "Electronics" |
$.fake.Color |
Color | "Blue" |
$.fake.HexColor |
HEX color | "#FF5733" |
$.fake.RGB |
RGB color | "rgb(255, 87, 51)" |
Examples:
{
"response": {
"payload": {
"company": {
"name": "$.fake.Company",
"slogan": "$.fake.CompanySlogan",
"industry": "$.fake.Industry"
},
"employee": {
"jobTitle": "$.fake.JobTitle",
"department": "$.fake.Department"
},
"product": {
"name": "$.fake.ProductName",
"category": "$.fake.ProductCategory",
"color": "$.fake.Color",
"price": "$.fake.Price"
},
"payment": {
"cardNumber": "$.fake.CreditCard",
"cardType": "$.fake.CreditCardType",
"currency": "$.fake.Currency"
}
}
}
}
Localized Data
Russian Data
| Function | Description | Example |
|---|---|---|
$.fake.RussianFirstNameMale |
Russian male first name | "Aleksandr" |
$.fake.RussianFirstNameFemale |
Russian female first name | "Anna" |
$.fake.RussianLastNameMale |
Russian male last name | "Ivanov" |
$.fake.RussianLastNameFemale |
Russian female last name | "Ivanova" |
$.fake.RussianCity |
Russian city | "Moskva" |
$.fake.RussianRegion |
Russian region | "Moskovskaya oblast" |
Chinese Data
| Function | Description | Example |
|---|---|---|
$.fake.ChineseFirstName |
Chinese first name | "Wei" |
$.fake.ChineseLastName |
Chinese last name | "Li" |
$.fake.ChineseName |
Chinese full name | "Li Wei" |
German Data
| Function | Description | Example |
|---|---|---|
$.fake.GermanFirstName |
German first name | "Hans" |
$.fake.GermanLastName |
German last name | "Mueller" |
Examples:
{
"response": {
"payload": {
"users": [
{
"locale": "ru",
"firstName": "$.fake.RussianFirstNameMale",
"lastName": "$.fake.RussianLastNameMale",
"city": "$.fake.RussianCity"
},
{
"locale": "cn",
"firstName": "$.fake.ChineseFirstName",
"lastName": "$.fake.ChineseLastName",
"fullName": "$.fake.ChineseName"
},
{
"locale": "de",
"firstName": "$.fake.GermanFirstName",
"lastName": "$.fake.GermanLastName"
}
]
}
}
}
Special Functions
Multimedia
| Function | Description | Example |
|---|---|---|
$.fake.ImageURL |
Image URL | "https://picsum.photos/640/480" |
$.fake.ImageURL(width, height) |
Image with dimensions | "https://picsum.photos/800/600" |
$.fake.AvatarURL |
User avatar | "https://i.pravatar.cc/150" |
$.fake.LoremPixel |
Lorem Pixel image | "http://lorempixel.com/640/480/" |
Security
| Function | Description | Example |
|---|---|---|
$.fake.Password |
Password | "Tr@nsf0rm3r!" |
$.fake.MD5 |
MD5 hash | "5d41402abc4b2a76b9719d911017c592" |
$.fake.SHA1 |
SHA1 hash | "aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d" |
$.fake.SHA256 |
SHA256 hash | "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" |
$.fake.JWT |
JSON Web Token | "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." |
Codes and Standards
| Function | Description | Example |
|---|---|---|
$.fake.ISBN10 |
ISBN-10 code | "0123456789" |
$.fake.ISBN13 |
ISBN-13 code | "9780123456789" |
$.fake.EAN8 |
EAN-8 barcode | "12345670" |
$.fake.EAN13 |
EAN-13 barcode | "1234567890128" |
$.fake.IBAN |
IBAN number | "GB82WEST12345698765432" |
Examples:
{
"response": {
"payload": {
"media": {
"avatar": "$.fake.AvatarURL",
"thumbnail": "$.fake.ImageURL(200, 200)",
"banner": "$.fake.ImageURL(1200, 300)"
},
"security": {
"token": "$.fake.JWT",
"passwordHash": "$.fake.SHA256",
"sessionId": "$.fake.MD5"
},
"product": {
"isbn": "$.fake.ISBN13",
"barcode": "$.fake.EAN13",
"sku": "SKU-$.fake.UUIDDigit"
}
}
}
}
Practical Examples
Complete User Profile
{
"id": "user-profile-complete",
"http": {
"route": "/api/users/profile"
},
"response": {
"payload": {
"user": {
"id": "$.fake.UUID",
"username": "$.fake.Username",
"profile": {
"firstName": "$.fake.FirstName",
"lastName": "$.fake.LastName",
"fullName": "$.fake.Name",
"avatar": "$.fake.AvatarURL",
"birthDate": "$.fake.PastDate",
"gender": "$.fake.Gender"
},
"contact": {
"email": "$.fake.Email",
"phone": "$.fake.Phone",
"website": "$.fake.URL"
},
"address": {
"street": "$.fake.StreetAddress",
"city": "$.fake.City",
"state": "$.fake.State",
"zip": "$.fake.Zip",
"country": "$.fake.Country",
"coordinates": {
"lat": "$.fake.Latitude",
"lng": "$.fake.Longitude"
}
},
"work": {
"company": "$.fake.Company",
"jobTitle": "$.fake.JobTitle",
"department": "$.fake.Department",
"industry": "$.fake.Industry"
},
"preferences": {
"language": "en",
"timezone": "UTC",
"theme": "dark",
"notifications": "$.fake.Bool"
},
"metadata": {
"createdAt": "$.fake.RFC3339",
"lastLoginAt": "$.fake.RFC3339",
"ipAddress": "$.fake.IPv4",
"userAgent": "$.fake.UserAgent"
}
}
}
}
}
E-commerce Product
{
"id": "ecommerce-product",
"http": {
"route": "/api/products/:id"
},
"response": {
"payload": {
"product": {
"id": "$.fake.UUIDDigit",
"sku": "PRD-$.fake.UUIDDigit",
"name": "$.fake.ProductName",
"description": "$.fake.Paragraph",
"category": "$.fake.ProductCategory",
"pricing": {
"price": "$.fake.Price",
"currency": "$.fake.Currency",
"currencySymbol": "$.fake.CurrencySymbol",
"originalPrice": "$.fake.Float64($.fake.Price * 1.1, $.fake.Price * 1.5)",
"discount": "$.fake.IntBetween(5, 50)"
},
"inventory": {
"inStock": "$.fake.Bool",
"quantity": "$.fake.IntBetween(0, 1000)",
"reserved": "$.fake.IntBetween(0, 100)"
},
"attributes": {
"color": "$.fake.Color",
"hexColor": "$.fake.HexColor",
"weight": "$.fake.Float64(0.1, 50.0)",
"dimensions": {
"length": "$.fake.Float64(1.0, 100.0)",
"width": "$.fake.Float64(1.0, 100.0)",
"height": "$.fake.Float64(1.0, 100.0)"
}
},
"media": {
"images": [
"$.fake.ImageURL(800, 600)",
"$.fake.ImageURL(800, 600)",
"$.fake.ImageURL(800, 600)"
],
"thumbnail": "$.fake.ImageURL(200, 200)",
"video": "$.fake.URL"
},
"ratings": {
"average": "$.fake.Float64(1.0, 5.0)",
"count": "$.fake.IntBetween(0, 10000)",
"distribution": {
"5star": "$.fake.IntBetween(0, 1000)",
"4star": "$.fake.IntBetween(0, 800)",
"3star": "$.fake.IntBetween(0, 500)",
"2star": "$.fake.IntBetween(0, 200)",
"1star": "$.fake.IntBetween(0, 100)"
}
},
"shipping": {
"freeShipping": "$.fake.Bool",
"weight": "$.fake.Float64(0.1, 10.0)",
"dimensions": "$.fake.Float64(1.0, 50.0) x $.fake.Float64(1.0, 50.0) x $.fake.Float64(1.0, 50.0)",
"estimatedDelivery": "$.fake.FutureDate"
},
"metadata": {
"createdAt": "$.fake.RFC3339",
"updatedAt": "$.fake.RFC3339",
"vendor": "$.fake.Company",
"vendorId": "$.fake.UUIDDigit",
"barcode": "$.fake.EAN13",
"isbn": "$.fake.ISBN13"
}
}
}
}
}
Financial Data
{
"id": "financial-transaction",
"http": {
"route": "/api/transactions"
},
"response": {
"payload": {
"transaction": {
"id": "$.fake.UUID",
"type": "payment",
"status": "completed",
"amount": {
"value": "$.fake.Price",
"currency": "$.fake.Currency",
"symbol": "$.fake.CurrencySymbol"
},
"fees": {
"processingFee": "$.fake.Float64(0.99, 9.99)",
"serviceFee": "$.fake.Float64(0.50, 5.00)"
},
"payment": {
"method": "credit_card",
"card": {
"number": "$.fake.CreditCard",
"type": "$.fake.CreditCardType",
"lastFour": "1234",
"expiryMonth": "$.fake.IntBetween(1, 12)",
"expiryYear": "$.fake.IntBetween(2024, 2030)"
}
},
"merchant": {
"id": "$.fake.UUIDDigit",
"name": "$.fake.Company",
"category": "$.fake.ProductCategory",
"address": "$.fake.Address"
},
"customer": {
"id": "$.fake.UUID",
"email": "$.fake.Email",
"name": "$.fake.Name",
"phone": "$.fake.Phone"
},
"timestamps": {
"createdAt": "$.fake.RFC3339",
"processedAt": "$.fake.RFC3339",
"completedAt": "$.fake.RFC3339"
},
"security": {
"transactionHash": "$.fake.SHA256",
"authorizationCode": "$.fake.MD5",
"riskScore": "$.fake.Float64(0.0, 100.0)"
}
}
}
}
}
Best Practices
Recommendations
-
Use appropriate data types:
"userId": "$.fake.UUID", // For IDs "age": "$.fake.IntBetween(18, 80)", // For age "email": "$.fake.Email" // For email -
Combine Faker with real data:
"displayName": "User $.fake.FirstName", "fullAddress": "$.fake.Address, Apt $.fake.IntBetween(1, 999)" -
Use realistic ranges:
"price": "$.fake.Float64(9.99, 999.99)", // Realistic price "rating": "$.fake.Float64(1.0, 5.0)", // Rating from 1 to 5 "percentage": "$.fake.Float64(0.0, 100.0)" // Percentage from 0 to 100 -
Structure complex objects:
"user": { "personal": { "firstName": "$.fake.FirstName", "lastName": "$.fake.LastName" }, "contact": { "email": "$.fake.Email", "phone": "$.fake.Phone" } }
What to Avoid
-
Do not use unrealistic ranges:
"age": "$.fake.IntBetween(1, 1000)" // Unrealistic "price": "$.fake.Float64(-100, 1000000)" // Negative price -
Do not mix data types without logic:
"id": "$.fake.FirstName" // Name as ID "email": "$.fake.Int" // Number as email
Use Faker to create realistic and diverse test data!
See Also
- JsonPath Guide – query language used together with Faker for dynamic responses
- Store Systems – persist Faker-generated data across mock invocations
- API Reference – complete REST API for creating mocks with Faker
- Web UI Guide – create mocks with Faker visually in the Constructor
- Quick Start – get started with your first Faker-powered mock