Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Datafake

The test data generation library powering Reframe sample generation.

What is Datafake?

Datafake is a Rust library for generating realistic test data, compatible with the Faker.js API. It provides generators for common data types including financial identifiers.

In Reframe, Datafake generates sample SWIFT MT and ISO 20022 messages for testing.

Role in Reframe

Generate Request
{
  "message_type": "MT103",
  "scenario": "standard"
}
      │
      ▼
┌─────────────────────────────────────────────┐
│              Datafake Engine                │
│                                             │
│  Generate:                                  │
│  • BIC codes (sender/receiver)              │
│  • IBAN accounts                            │
│  • Currency amounts                         │
│  • Company names                            │
│  • Addresses                                │
│  • Transaction references                   │
│  • UUIDs (UETR)                             │
└─────────────────────────────────────────────┘
      │
      ▼
Sample Message

Key Features

Financial Data Generators

GeneratorExample Output
BICBNPAFRPPXXX
IBANFR7630006000011234567890189
CurrencyUSD, EUR, GBP
Amount50000.00
LEI5493001KJTIIGC8Y1R12

General Data Generators

GeneratorExample Output
Company nameAcme International Inc
Address123 Main Street, New York NY 10001
CountryUS, DE, GB
Date2025-01-15
UUIDf47ac10b-58cc-4372-a567-0e02b2c3d479

Deterministic Output

With seeding, generates reproducible data:

{
  "variables": {
    "ref": {"fake": ["uuid"]},
    "amount": {"fake": ["u64", 1000, 100000]}
  },
  "seed": 12345
}

Interactive Playground

Try Datafake generators in the browser:

Datafake Playground →

Resources

Scenario Configuration

Sample scenarios use Datafake in variable definitions:

{
  "description": "MT103 Standard Transfer",
  "variables": {
    "sender_bic": {"fake": ["bic"]},
    "receiver_bic": {"fake": ["bic"]},
    "currency": {"fake": ["enum", "USD", "EUR", "GBP"]},
    "amount": {"fake": ["u64", 5000, 500000]},
    "uetr": {"fake": ["uuid"]},
    "sender_name": {"fake": ["company_name"]},
    "receiver_name": {"fake": ["company_name"]},
    "reference": {"fake": ["alphanumeric", 16]}
  },
  "schema": {
    "basic_header": {
      "sender_bic": "{{sender_bic}}"
    },
    "fields": {
      "20": {"transaction_reference": "{{reference}}"},
      "32A": {
        "currency": "{{currency}}",
        "amount": "{{amount}}"
      }
    }
  }
}

Generator Types

String Generators

{"fake": ["alphanumeric", 10]}
{"fake": ["alpha", 5]}
{"fake": ["numeric", 8]}
{"fake": ["uuid"]}

Number Generators

{"fake": ["u64", 1000, 100000]}
{"fake": ["f64", 0.0, 100.0]}
{"fake": ["i32", -100, 100]}

Financial Generators

{"fake": ["bic"]}
{"fake": ["iban", "DE"]}
{"fake": ["currency_code"]}
{"fake": ["lei"]}

Selection Generators

{"fake": ["enum", "USD", "EUR", "GBP", "JPY"]}
{"fake": ["one_of", ["Option A", "Option B", "Option C"]]}

Date Generators

{"fake": ["date_future", 30]}
{"fake": ["date_past", 90]}
{"fake": ["datetime"]}

Datalogic →

Sample Generation Feature →