ff26a6a3738ad11211bbdaeb830f899992343049
TestData CLI
A CLI tool that generates realistic test data from JSON Schema, TypeScript types, or sample data files using Faker-style generation.
Features
- Generate realistic test data from JSON Schema
- Support for Faker-style data generation (names, emails, addresses, dates)
- Bulk data generation with configurable count
- Multiple output formats: JSON, CSV, and SQL
- Generate from TypeScript types
- Generate from sample data files
- Custom pattern support with regex-based generation
- Seed support for reproducible data generation
Installation
pip install testdata-cli
# or
pip install -e .
Quick Start
Generate data from a JSON Schema file:
testdatagen generate --schema schema.json --count 10
Generate with specific output format:
testdatagen generate --schema schema.json --format csv --count 5
Use a seed for reproducible results:
testdatagen generate --schema schema.json --seed 12345
Commands
generate
Generate test data from a JSON Schema file.
testdatagen generate --schema <file> [options]
Options:
--schema,-s: Path to JSON Schema file (required)--count,-n: Number of records to generate (default: 10)--format,-f: Output format - json, csv, or sql (default: json)--seed: Random seed for reproducibility--table: Table name for SQL output (default: generated_table)
from-ts
Generate test data from a TypeScript type definition.
testdatagen from-ts --input <file.ts> [options]
from-sample
Generate test data from a sample data file.
testdatagen from-sample --input <file.json> [options]
Configuration
Default options can be configured in ~/.testdatagen.yaml:
default-seed: 42
default-count: 10
Or in pyproject.toml:
[tool.testdatagen]
default-seed = 42
default-count = 10
Schema Reference
Supported Types
| JSON Schema Type | Faker Generation |
|---|---|
| string (email format) | fake.email() |
| string (date-time format) | fake.date_time() |
| string (uuid format) | fake.uuid4() |
| string (uri format) | fake.uri() |
| string (with pattern) | Pattern-based generation |
| integer | fake.random_int() |
| number | fake.pyfloat() |
| boolean | fake.pybool() |
| object | Recursive generation |
| array | List generation with items |
| enum | random_element() |
License
MIT License
Languages
Python
100%