Initial upload: testdata-cli with CI/CD workflow
Some checks failed
CI / test (push) Has been cancelled
CI / build (push) Has been cancelled

This commit is contained in:
2026-03-22 19:45:23 +00:00
parent 250c264e66
commit fee04786c7

113
README.md
View File

@@ -1,3 +1,114 @@
# testdata-cli # TestData CLI
A CLI tool that generates realistic test data from JSON Schema, TypeScript types, or sample data files using Faker-style generation. 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
```bash
pip install testdata-cli
# or
pip install -e .
```
## Quick Start
Generate data from a JSON Schema file:
```bash
testdatagen generate --schema schema.json --count 10
```
Generate with specific output format:
```bash
testdatagen generate --schema schema.json --format csv --count 5
```
Use a seed for reproducible results:
```bash
testdatagen generate --schema schema.json --seed 12345
```
## Commands
### generate
Generate test data from a JSON Schema file.
```bash
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.
```bash
testdatagen from-ts --input <file.ts> [options]
```
### from-sample
Generate test data from a sample data file.
```bash
testdatagen from-sample --input <file.json> [options]
```
## Configuration
Default options can be configured in `~/.testdatagen.yaml`:
```yaml
default-seed: 42
default-count: 10
```
Or in `pyproject.toml`:
```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