@intentsolutionsio/test-data-generator 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/agents/data-generator.md
CHANGED
|
@@ -9,6 +9,7 @@ Generate realistic test data including users, products, orders, and custom schem
|
|
|
9
9
|
## Data Types
|
|
10
10
|
|
|
11
11
|
### User Data
|
|
12
|
+
|
|
12
13
|
- Names (realistic, locale-aware)
|
|
13
14
|
- Email addresses
|
|
14
15
|
- Passwords (hashed if needed)
|
|
@@ -19,6 +20,7 @@ Generate realistic test data including users, products, orders, and custom schem
|
|
|
19
20
|
- Profile info
|
|
20
21
|
|
|
21
22
|
### Business Data
|
|
23
|
+
|
|
22
24
|
- Products (name, description, price, SKU)
|
|
23
25
|
- Orders (items, totals, status)
|
|
24
26
|
- Invoices
|
|
@@ -27,6 +29,7 @@ Generate realistic test data including users, products, orders, and custom schem
|
|
|
27
29
|
- Categories
|
|
28
30
|
|
|
29
31
|
### Technical Data
|
|
32
|
+
|
|
30
33
|
- UUIDs
|
|
31
34
|
- Timestamps
|
|
32
35
|
- IP addresses
|
|
@@ -36,6 +39,7 @@ Generate realistic test data including users, products, orders, and custom schem
|
|
|
36
39
|
- Tokens
|
|
37
40
|
|
|
38
41
|
### Custom Schemas
|
|
42
|
+
|
|
39
43
|
- JSON Schema support
|
|
40
44
|
- Database schema import
|
|
41
45
|
- TypeScript types
|
package/package.json
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: generating-test-data
|
|
3
|
-
description:
|
|
4
|
-
|
|
3
|
+
description: 'Generate realistic test data including edge cases and boundary conditions.
|
|
4
|
+
|
|
5
5
|
Use when creating realistic fixtures or edge case test data.
|
|
6
|
-
Trigger with phrases like "generate test data", "create fixtures", or "setup test database".
|
|
7
6
|
|
|
7
|
+
Trigger with phrases like "generate test data", "create fixtures", or "setup test
|
|
8
|
+
database".
|
|
9
|
+
|
|
10
|
+
'
|
|
8
11
|
allowed-tools: Read, Write, Edit, Grep, Glob, Bash(test:data-*)
|
|
9
12
|
version: 1.0.0
|
|
10
13
|
author: Jeremy Longshore <jeremy@intentsolutions.io>
|
|
11
14
|
license: MIT
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
tags:
|
|
16
|
+
- testing
|
|
17
|
+
- database
|
|
18
|
+
- test-data
|
|
19
|
+
compatibility: Designed for Claude Code, also compatible with Codex and OpenClaw
|
|
14
20
|
---
|
|
15
21
|
# Test Data Generator
|
|
16
22
|
|
|
@@ -74,6 +80,7 @@ Generate realistic, type-safe test data including fixtures, factory functions, s
|
|
|
74
80
|
## Examples
|
|
75
81
|
|
|
76
82
|
**TypeScript factory with Fishery:**
|
|
83
|
+
|
|
77
84
|
```typescript
|
|
78
85
|
import { Factory } from 'fishery';
|
|
79
86
|
import { faker } from '@faker-js/faker';
|
|
@@ -101,6 +108,7 @@ const users = userFactory.buildList(10);
|
|
|
101
108
|
```
|
|
102
109
|
|
|
103
110
|
**pytest fixture factory:**
|
|
111
|
+
|
|
104
112
|
```python
|
|
105
113
|
import pytest
|
|
106
114
|
from faker import Faker
|
|
@@ -125,6 +133,7 @@ def test_user_validation(make_user):
|
|
|
125
133
|
```
|
|
126
134
|
|
|
127
135
|
**Edge case data collection:**
|
|
136
|
+
|
|
128
137
|
```typescript
|
|
129
138
|
export const edgeCases = {
|
|
130
139
|
strings: ['', ' ', '\t\n', 'a'.repeat(10000), '<script>alert(1)</script>', # 10000: 10 seconds in ms
|
|
@@ -140,4 +149,4 @@ export const edgeCases = {
|
|
|
140
149
|
- Fishery (TypeScript factories): https://github.com/thoughtbot/fishery
|
|
141
150
|
- factory_boy (Python): https://factoryboy.readthedocs.io/
|
|
142
151
|
- Chance.js: https://chancejs.com/
|
|
143
|
-
- Test data management patterns: https://martinfowler.com/bliki/ObjectMother.html
|
|
152
|
+
- Test data management patterns: https://martinfowler.com/bliki/ObjectMother.html
|
|
@@ -5,16 +5,17 @@ A script to generate test data based on provided schema or pre-defined types (us
|
|
|
5
5
|
Generated: 2025-12-10 03:48:17
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
-
import os
|
|
9
8
|
import json
|
|
10
9
|
import argparse
|
|
11
10
|
from pathlib import Path
|
|
12
11
|
from datetime import datetime
|
|
12
|
+
from typing import Dict
|
|
13
|
+
|
|
13
14
|
|
|
14
15
|
class Generator:
|
|
15
16
|
def __init__(self, config: Dict):
|
|
16
17
|
self.config = config
|
|
17
|
-
self.output_dir = Path(config.get(
|
|
18
|
+
self.output_dir = Path(config.get("output", "./output"))
|
|
18
19
|
self.output_dir.mkdir(parents=True, exist_ok=True)
|
|
19
20
|
|
|
20
21
|
def generate_markdown(self, title: str, content: str) -> Path:
|
|
@@ -25,7 +26,7 @@ class Generator:
|
|
|
25
26
|
md_content = f"""# {title}
|
|
26
27
|
|
|
27
28
|
Generated by test-data-generator
|
|
28
|
-
Date: {datetime.now().strftime(
|
|
29
|
+
Date: {datetime.now().strftime("%Y-%m-%d %H:%M:%S")}
|
|
29
30
|
|
|
30
31
|
## Overview
|
|
31
32
|
{content}
|
|
@@ -56,10 +57,10 @@ test-data-generator
|
|
|
56
57
|
"category": "testing",
|
|
57
58
|
"plugin": "test-data-generator",
|
|
58
59
|
"data": data,
|
|
59
|
-
"config": self.config
|
|
60
|
+
"config": self.config,
|
|
60
61
|
}
|
|
61
62
|
|
|
62
|
-
with open(file_path,
|
|
63
|
+
with open(file_path, "w") as f:
|
|
63
64
|
json.dump(output_data, f, indent=2)
|
|
64
65
|
|
|
65
66
|
return file_path
|
|
@@ -71,7 +72,7 @@ test-data-generator
|
|
|
71
72
|
|
|
72
73
|
script_content = f"""#!/bin/bash
|
|
73
74
|
# Generated by test-data-generator
|
|
74
|
-
# Date: {datetime.now().strftime(
|
|
75
|
+
# Date: {datetime.now().strftime("%Y-%m-%d %H:%M:%S")}
|
|
75
76
|
|
|
76
77
|
set -e # Exit on error
|
|
77
78
|
|
|
@@ -87,17 +88,20 @@ echo "✅ Completed successfully"
|
|
|
87
88
|
file_path.chmod(0o755) # Make executable
|
|
88
89
|
return file_path
|
|
89
90
|
|
|
91
|
+
|
|
90
92
|
def main():
|
|
91
|
-
parser = argparse.ArgumentParser(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
parser.add_argument(
|
|
95
|
-
parser.add_argument(
|
|
96
|
-
parser.add_argument(
|
|
93
|
+
parser = argparse.ArgumentParser(
|
|
94
|
+
description="A script to generate test data based on provided schema or pre-defined types (users, products, orders)."
|
|
95
|
+
)
|
|
96
|
+
parser.add_argument("--type", choices=["markdown", "json", "script"], default="markdown")
|
|
97
|
+
parser.add_argument("--output", "-o", default="./output", help="Output directory")
|
|
98
|
+
parser.add_argument("--config", "-c", help="Configuration file")
|
|
99
|
+
parser.add_argument("--title", default="test-data-generator Output")
|
|
100
|
+
parser.add_argument("--content", help="Content to include")
|
|
97
101
|
|
|
98
102
|
args = parser.parse_args()
|
|
99
103
|
|
|
100
|
-
config = {
|
|
104
|
+
config = {"output": args.output}
|
|
101
105
|
if args.config and Path(args.config).exists():
|
|
102
106
|
with open(args.config) as f:
|
|
103
107
|
config.update(json.load(f))
|
|
@@ -106,24 +110,20 @@ def main():
|
|
|
106
110
|
|
|
107
111
|
print(f"🔧 Generating {args.type} output...")
|
|
108
112
|
|
|
109
|
-
if args.type ==
|
|
110
|
-
output_file = generator.generate_markdown(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
)
|
|
114
|
-
elif args.type == 'json':
|
|
115
|
-
output_file = generator.generate_json(
|
|
116
|
-
{"title": args.title, "content": args.content}
|
|
117
|
-
)
|
|
113
|
+
if args.type == "markdown":
|
|
114
|
+
output_file = generator.generate_markdown(args.title, args.content or "Generated content")
|
|
115
|
+
elif args.type == "json":
|
|
116
|
+
output_file = generator.generate_json({"title": args.title, "content": args.content})
|
|
118
117
|
else: # script
|
|
119
118
|
output_file = generator.generate_script(
|
|
120
|
-
args.title.lower().replace(
|
|
121
|
-
args.content or "# Add your script content here"
|
|
119
|
+
args.title.lower().replace(" ", "_"), args.content or "# Add your script content here"
|
|
122
120
|
)
|
|
123
121
|
|
|
124
122
|
print(f"✅ Generated: {output_file}")
|
|
125
123
|
return 0
|
|
126
124
|
|
|
125
|
+
|
|
127
126
|
if __name__ == "__main__":
|
|
128
127
|
import sys
|
|
128
|
+
|
|
129
129
|
sys.exit(main())
|