generate-test-data
Skill28 starsChanged 4 months agoMITView on GitHub
Sinh test data có cấu trúc, unique, traceable cho test cases. Hỗ trợ UI forms, API payloads, data-driven tests.
- Reads credentials
- Deletes or force-pushes
In this repository26 other files it gives its agents.
- AGENTS.mdAGENTS.md
- analyze-flaky-testsSkill
- analyze-requirement-documentSkill
- fetch-jira-requirementsSkill
- flaky-test-analyzerSkill
- framework-architectSkill
- generate-api-tests-from-swaggerSkill
- generate-application-test-planSkill
- generate-automation-frameworkSkill
- generate-automation-from-testcasesSkill
- generate-automation-from-ui-flowSkill
- generate-combinatorial-test-dataSkill
- generate-cross-module-test-planSkill
- generate-locatorSkill
- generate-manual-testcases-rbtSkill
- generate-requirements-from-websiteSkill
- generate-testcases-from-requirementsSkill
- import-test-results-xraySkill
- jira-integrationSkill
- locator-healer-agentSkill
- qa-automation-engineerSkill
- rbt-manual-testingSkill
- requirements-analyzerSkill
- smart-locator-agentSkill
- test-data-generatorSkill
- ui-debug-agentSkill
The file
Files
$generate-test-data — Sinh Test Data Có Cấu Trúc
User cung cấp feature/module hoặc test cases cần sinh data. AI phân tích fields, constraints, sinh bộ data đầy đủ (positive, negative, boundary, edge cases) với format sẵn sàng sử dụng.
BẮT BUỘC (MANDATORY): Trước khi bắt đầu, PHẢI nạp và đọc kỹ:
- Skill:
.agents/skills/test-data-generator/SKILL.md— Quy tắc sinh data- Rule:
.agents/rules/automation_rules.md— Section Test Data
Input cần từ User
| Input | Bắt buộc | Mô tả |
| Feature / Module | ✅ | VD: "Form đăng ký", "API Create User", "Trang Login" |
| Fields cần data | ⚠️ Nên có | Danh sách fields + constraints. Nếu không có → AI tự phân tích từ DOM/Spec |
| URL trang / Swagger spec | ❌ | Nếu có → AI inspect DOM/Spec để lấy validation rules chính xác |
| Test cases | ❌ | Nếu đã có test cases → AI sinh data match từng TC |
| Output format | ❌ | json (mặc định), csv, markdown table, code (TypeScript/Java/Python) |
| Ngôn ngữ data | ❌ | Tiếng Việt / Tiếng Anh (mặc định: theo context) |
Các bước thực hiện
Bước 1: Phân tích Fields & Constraints
Xác định nguồn thông tin:
Nguồn Cách lấy Ưu tiên User cung cấp trực tiếp Đọc từ input ⭐ Cao nhất DOM thực tế (UI form) browser_navigate→browser_snapshot→ phân tích input fields⭐ Cao Swagger/OpenAPI spec read_url_content→ parse schema + constraints⭐ Cao Test cases đã có Đọc test steps → trích xuất fields Trung bình Đoán từ tên module Dựa trên kinh nghiệm domain ⭐ Thấp nhất Với mỗi field, xác định:
Attribute Ví dụ Tên field email, password, name, phone Kiểu dữ liệu string, number, boolean, date, file, enum Required? Bắt buộc hay tùy chọn Validation rules min/maxLength, pattern/regex, format (email, phone), unique Giá trị mặc định Nếu có Enum values VD: status = ["AVAILABLE", "UNAVAILABLE"] Quan hệ phụ thuộc VD: password_confirmphải khớppasswordTrình bày bảng Fields cho User xác nhận (CHECKPOINT ⏸️):
| # | Field | Type | Required | Constraints | Notes | |---|-------|------|----------|-------------|-------| | 1 | email | string | ✅ | format: email, unique | Dùng để login | | 2 | password | string | ✅ | minLength: 6 | | | 3 | name | string | ✅ | maxLength: 100 | | | 4 | phone | string | ❌ | pattern: /^0[0-9]{9}$/ | 10 chữ số, bắt đầu bằng 0 |Chờ User xác nhận hoặc bổ sung constraints trước khi sang Bước 2.
Bước 2: Sinh Test Data theo 4 Categories
Với mỗi field đã xác định, sinh data theo bảng sau:
2A. Positive Data (Happy Path)
- Giá trị hợp lệ, đúng format, trong constraints
- Tất cả required fields được điền
- Dữ liệu phải unique + traceable
Format unique data:
<prefix>_<testName>_<timestamp>Ví dụ:
email: auto_register_1712049200@test.com
username: user_login_1712049200
code: TC_BOOK_17120492002B. Negative Data
| Loại | Mô tả | Ví dụ |
| Missing required | Bỏ trống field bắt buộc | email: "" |
| Invalid format | Sai format | email: "not-an-email" |
| Invalid type | Sai kiểu dữ liệu | price: "abc" (expect number) |
| Duplicate | Giá trị đã tồn tại | email: "existing@test.com" |
| Invalid characters | Ký tự không được phép | name: "<script>alert(1)</script>" |
| Wrong relationship | Vi phạm quan hệ fields | password_confirm ≠ password |
2C. Boundary Values
| Loại | Mô tả | Ví dụ (field có minLength=6, maxLength=20) |
| Min | Đúng bằng min | "abcdef" (6 chars) |
| Min - 1 | Dưới min | "abcde" (5 chars) |
| Max | Đúng bằng max | "a" * 20 (20 chars) |
| Max + 1 | Vượt max | "a" * 21 (21 chars) |
| Empty | Chuỗi rỗng | "" |
| Zero | Số 0 (cho number fields) | 0 |
| Negative | Số âm (cho number fields) | -1 |
2D. Edge Cases
| Loại | Mô tả | Ví dụ |
| Unicode | Ký tự đặc biệt Unicode | "Nguyễn Văn 🎉" |
| Very long | Chuỗi cực dài | "a" * 10000 |
| Whitespace | Khoảng trắng đầu/cuối | " email@test.com " |
| SQL injection | Pattern SQL injection | "'; DROP TABLE users; --" |
| HTML tags | HTML trong text field | "<b>bold</b><img src=x onerror=alert(1)>" |
| Null/undefined | Giá trị null | null |
| Special numbers | Số đặc biệt | 0.1 + 0.2, Number.MAX_SAFE_INTEGER, NaN |
| Date edge | Ngày đặc biệt | "2024-02-29" (năm nhuận), "2024-12-31", "1970-01-01" |
Bước 3: Đóng gói Output
Trả kết quả theo format User yêu cầu (mặc định: JSON):
Format JSON (mặc định)
{
"module": "User Registration",
"totalDataSets": 15,
"fields": ["email", "password", "name", "phone"],
"positive": [
{
"id": "POS_01",
"description": "Đăng ký thành công với tất cả fields hợp lệ",
"data": {
"email": "auto_register_1712049200@test.com",
"password": "Test@12345",
"name": "Auto User Register",
"phone": "0912345001"
},
"expectedResult": "Tạo tài khoản thành công, status 201"
}
],
"negative": [
{
"id": "NEG_01",
"description": "Email trống",
"data": { "email": "", "password": "Test@12345", "name": "Test User" },
"expectedResult": "Lỗi validation: Email is required",
"targetField": "email",
"negativeType": "missing_required"
},
{
"id": "NEG_02",
"description": "Email sai format",
"data": { "email": "not-email", "password": "Test@12345", "name": "Test User" },
"expectedResult": "Lỗi validation: Invalid email format",
"targetField": "email",
"negativeType": "invalid_format"
}
],
"boundary": [
{
"id": "BND_01",
"description": "Password đúng min length (6 chars)",
"data": { "email": "auto_bnd01_1712049200@test.com", "password": "Abc@12", "name": "Test User" },
"expectedResult": "Thành công",
"targetField": "password",
"boundaryType": "min"
}
],
"edgeCases": [
{
"id": "EDGE_01",
"description": "Name chứa Unicode tiếng Việt + emoji",
"data": { "email": "auto_edge01_1712049200@test.com", "password": "Test@12345", "name": "Nguyễn Văn 🎉" },
"expectedResult": "Thành công — hệ thống chấp nhận Unicode",
"targetField": "name",
"edgeType": "unicode"
}
]
}Format Markdown Table
| ID | Category | Description | email | password | name | Expected Result |
|----|----------|-------------|-------|----------|------|-----------------|
| POS_01 | Positive | Đăng ký thành công | auto_reg@test.com | Test@12345 | Auto User | 201 Created |
| NEG_01 | Negative | Email trống | (empty) | Test@12345 | Test User | 422: Email is required |
| BND_01 | Boundary | Password min length | auto_bnd@test.com | Abc@12 | Test User | 201 Created |Format Code (TypeScript example)
// test-data/registration.data.ts
export const registrationData = {
positive: {
email: `auto_register_${Date.now()}@test.com`,
password: 'Test@12345',
name: 'Auto User Register',
phone: '0912345001',
},
negative: {
emptyEmail: { email: '', password: 'Test@12345', name: 'Test' },
invalidEmail: { email: 'not-email', password: 'Test@12345', name: 'Test' },
shortPassword: { email: `auto_neg_${Date.now()}@test.com`, password: '123', name: 'Test' },
},
boundary: {
minPassword: { email: `auto_bnd_${Date.now()}@test.com`, password: 'Abc@12', name: 'Test' },
maxName: { email: `auto_bnd_${Date.now()}@test.com`, password: 'Test@12345', name: 'A'.repeat(100) },
},
};Data Rules (BẮT BUỘC)
| # | Rule | Mô tả |
| 1 | Unique | Không trùng lặp trong test suite — dùng timestamp/random |
| 2 | Traceable | Có thể truy ngược test nào sinh ra data — dùng prefix + test name |
| 3 | No real PII | KHÔNG dùng dữ liệu cá nhân thật (số CCCD, email thật, SĐT thật) |
| 4 | Respect constraints | Data phải tuân theo validation rules đã phân tích |
| 5 | Include expectedResult | Mỗi data set PHẢI có expected result để dùng cho assertion |
| 6 | Deterministic khi cần | Cùng seed → cùng data (cho reproducible tests) |
NGHIÊM CẤM
| ❌ Không được làm | ✅ Thay thế đúng |
Dùng placeholder (email hợp lệ, mã số hợp lệ) | Giá trị cụ thể: auto_tc01@test.com, KH-2026-0012 |
| Hardcode data trùng lặp giữa các test | Random data với prefix + timestamp |
| Dùng dữ liệu cá nhân thật | Data giả lập: auto_*@test.com |
| Chỉ sinh positive data | Bắt buộc cả 4 categories: Positive + Negative + Boundary + Edge |
| Sinh data không có expected result | Mỗi data set PHẢI nêu rõ expected result |
| Đoán validation rules không kiểm tra | Inspect DOM/Spec hoặc hỏi User |
Đọc .env để lấy credentials | Hỏi User hoặc dùng placeholder [FROM_ENV] |
Checklist cuối
- Đã phân tích đầy đủ fields + constraints
- User đã xác nhận bảng fields trước khi sinh data
- Data có đủ 4 categories (Positive, Negative, Boundary, Edge Cases)
- Mỗi data set có expected result rõ ràng
- Data unique + traceable (prefix + timestamp/random)
- Không chứa real PII
- Format output đúng yêu cầu User (JSON/CSV/Markdown/Code)
- Boundary values đúng theo constraints (min, min-1, max, max+1)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

