agentleFS
anhtesteranhtester/codex-testing-kit/.agents/skills/generate-combinatorial-test-data/SKILL.md

generate-combinatorial-test-data

Skill28 starsChanged 4 months agoMITView on GitHub

Sinh test data cho ma trận kết hợp đa chiều bằng pipeline chạy thật qua nhiều modules. Dùng đầu ra từ skill generate-cross-module-test-plan làm input.

  • Reads credentials

The file

Files
SKILL.md

$generate-combinatorial-test-data — Sinh Test Data Cho Ma Trận Kết Hợp

Dùng khi: Đã có ma trận kết hợp (từ $generate-cross-module-test-plan) và cần tạo test data thực tế bằng cách chạy qua nhiều modules trên browser, hoặc sinh bộ data có cấu trúc sẵn sàng cho automation.

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 (xem phần Multi-Step Pipeline)
  • Skill: .agents/skills/ui-debug-agent/SKILL.md — Inspect DOM khi chạy browser
  • Workflow: .agents/skills/generate-cross-module-test-plan/SKILL.md — Hiểu cấu trúc ma trận đầu vào

Mối quan hệ với các workflows khác

$generate-cross-module-test-plan     →  Ma trận kết hợp (input)
        ↓
$generate-combinatorial-test-data    →  Bộ test data (workflow này)
        ↓
$generate-manual-testcases-rbt       →  Test cases chi tiết
        ↓
$generate-automation-from-testcases  →  Automation scripts

2 Modes

ModeKhi nào dùngOutput
GENERATE (mặc định)Sinh bộ data có cấu trúc từ ma trận — KHÔNG chạy browserFile JSON/CSV/Markdown với data cho mỗi bộ kết hợp
PIPELINECần tạo data THẬT trên hệ thống bằng cách chạy qua từng module trên browserData thật đã tạo + IDs + screenshots evidence

Agent tự chọn mode:

  • User nói "sinh data", "generate data" → GENERATE
  • User nói "tạo data trên hệ thống", "chạy tạo data", "setup data thật" → PIPELINE
  • Nếu không rõ → hỏi user

Input cần từ User

InputBắt buộcMô tả
Ma trận kết hợp✅File .md / bảng Markdown từ $generate-cross-module-test-plan
URL ứng dụng✅ (PIPELINE)Để agent chạy browser tạo data
Credentials⚠️ PIPELINENếu app cần đăng nhập
Output format❌json (mặc định), csv, markdown, code (TS/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: Đọc & Parse Ma Trận Kết Hợp

  1. Đọc file ma trận từ user cung cấp:
    • File local → view_file
    • Inline trong chat → parse trực tiếp
    • URL → read_url_content
  2. Parse và validate:
    • Xác định danh sách dimensions (D1, D2, D3...)
    • Xác định values của mỗi dimension
    • Đọc expected template/formula cho mỗi bộ
    • Đếm tổng số bộ kết hợp cần sinh data
  3. Trình bày tóm tắt:
    📊 Ma trận đã đọc:
    - Dimensions: 5 (Đối tác, Thanh toán, Thuế, Công nợ, Nguồn TS)
    - Tổng bộ kết hợp: 20 (Pairwise)
    - Mode: GENERATE / PIPELINE
    
    Bắt đầu sinh data? (Y/N)

Bước 2: Phân Tích Fields & Data Requirements Mỗi Module

  1. Với mỗi module trong chuỗi, xác định fields cần data:

    | Module | Field | Type | Required | Constraints | Data Source |
    |--------|-------|------|----------|-------------|-------------|
    | Đối tác | partner_name | string | ✅ | max: 200 | Random + prefix |
    | Đối tác | partner_type | select | ✅ | enum: [TC, CN, HKD] | Từ dimension D1 |
    | Đối tác | tax_id | string | ✅ | 10-13 digits | Random unique |
    | Thanh toán | currency | select | ✅ | enum: [VND, USD] | Từ dimension D2 |
    | Thanh toán | amount | number | ✅ | min: 1 | Business-relevant values |
    | Thuế | tax_type | select | ✅ | enum: [PIT, VAT, NT, MT] | Từ dimension D3 |
    | ...| ... | ... | ... | ... | ... |
  2. Phân loại fields:

    LoạiMô tảCách sinh data
    Dimension fieldsGiá trị thuộc dimension trong ma trậnLấy từ bộ kết hợp (không random)
    Supporting fieldsFields bắt buộc nhưng không phải dimensionSinh random + unique + traceable
    Computed fieldsTự tính từ formulaTính theo business rules
    Reference fieldsID/code từ module trướcCopy từ output module trước

Bước 3: Sinh Test Data — Mode GENERATE

Thực hiện khi mode = GENERATE (mặc định)

  1. Với mỗi bộ kết hợp trong ma trận, sinh 1 bộ data đầy đủ:

    {
      "combination_id": "COMBO_01",
      "dimensions": {
        "D1_partner_type": "Tổ chức",
        "D2_payment_type": "VND",
        "D3_tax_type": "VAT 10%",
        "D4_debt_type": "Thông thường",
        "D5_asset_source": "Quỹ A"
      },
      "module_data": {
        "module_1_partner": {
          "partner_name": "auto_combo01_tc_1712049200",
          "partner_type": "Tổ chức",
          "tax_id": "0123456789",
          "address": "Số 1 Nguyễn Huệ, Q1, HCM"
        },
        "module_2_payment": {
          "currency": "VND",
          "amount": 100000000,
          "payment_date": "2026-04-15",
          "description": "Thanh toán combo01"
        },
        "module_3_tax": {
          "tax_type": "VAT",
          "tax_rate": 10,
          "tax_amount": 10000000
        },
        "module_4_debt": {
          "debt_type": "Thông thường",
          "advance_amount": 0
        }
      },
      "expected_output": {
        "template": "BB_TC_VND_VAT",
        "formula": "Amount × 1.10",
        "computed_total": 110000000,
        "expected_fields": ["partner_name", "tax_id", "amount", "tax_amount", "total"]
      }
    }
  2. Sinh đủ data cho TẤT CẢ bộ kết hợp → đóng gói vào 1 file output
  3. Đảm bảo data rules:
    • Unique per combo (không trùng giữa các bộ)
    • Traceable: prefix auto_combo{XX}_{dimension_short}
    • No real PII
    • Computed values phải đúng theo formula

Bước 3P: Sinh Test Data — Mode PIPELINE (chạy thật trên browser)

Thực hiện khi mode = PIPELINE

  1. Mở browser bằng MCP:
    browser_navigate → URL ứng dụng
    browser_resize → 1920 × 1080
  2. Loop qua từng bộ kết hợp:

    FOR each combo in matrix:
      FOR each module in chain:
        1. Navigate → module URL
        2. browser_snapshot → xác nhận state
        3. Điền data theo bộ combo:
           - Dimension fields → chọn giá trị theo combo
           - Supporting fields → sinh random + traceable
        4. Submit / Save
        5. browser_wait_for → confirm success
        6. browser_snapshot → capture kết quả
        7. Extract output (ID, code...) → lưu cho module tiếp theo
      END FOR
      
      // Ở module cuối — verify output
      8. Capture biên bản / output cuối
      9. browser_take_screenshot → evidence
      10. Ghi nhận: combo_id, created_ids, template_found, formula_verified
    END FOR
  3. Xử lý lỗi trong pipeline:

    LỗiCách xử lý
    Submit fail (validation)Screenshot → ghi log → skip combo → báo user
    Module load chậmbrowser_wait_for với timeout tăng dần
    Session expiredRe-login → retry từ module bị fail
    Data trùngSinh lại data unique, retry
    Combo không hợp lệ (constraint)Skip → đánh dấu "INVALID" trong report
  4. Giới hạn pipeline:
    • Tối đa 30 bộ kết hợp / phiên chạy (tránh timeout)
    • Nếu > 30 → chia batch, hỏi user "Tiếp tục batch tiếp?"
    • Sau mỗi 10 bộ → báo progress cho user

Bước 4: Đóng Gói Output & Báo Cáo

Output cho Mode GENERATE:

Tạo artifact file(s) theo format user yêu cầu:

JSON (mặc định):

{
  "feature": "Biên bản thanh toán đối tác",
  "generated_at": "2026-04-15T17:00:00Z",
  "strategy": "pairwise",
  "total_combinations": 20,
  "dimensions": ["partner_type", "payment_type", "tax_type", "debt_type", "asset_source"],
  "data_sets": [
    { "combination_id": "COMBO_01", "dimensions": {...}, "module_data": {...}, "expected_output": {...} },
    { "combination_id": "COMBO_02", ... }
  ]
}

Markdown Table:

| Combo | Đối tác | Thanh toán | Thuế | Công nợ | Nguồn | Partner Name | Amount | Expected Template | Expected Total |
|-------|---------|-----------|------|---------|-------|-------------|--------|------------------|----------------|
| 01 | Tổ chức | VND | VAT | Thường | Quỹ A | auto_c01_tc | 100M | BB_TC_VND_VAT | 110M |
| 02 | ... | ... | ... | ... | ... | ... | ... | ... | ... |

Code (TypeScript example):

// test-data/payment-record.data.ts
export const combinatorialData = [
  {
    id: 'COMBO_01',
    partner: { name: `auto_combo01_${Date.now()}`, type: 'Tổ chức', taxId: '0123456789' },
    payment: { currency: 'VND', amount: 100_000_000 },
    tax: { type: 'VAT', rate: 10 },
    expected: { template: 'BB_TC_VND_VAT', total: 110_000_000 },
  },
  // ... more combos
];

Output cho Mode PIPELINE:

## Pipeline Execution Report

| # | Combo | Status | Module 1 ID | Module 2 ID | Module 3 ID | Output Template | Formula ✓ | Screenshot |
|---|-------|--------|------------|------------|------------|-----------------|-----------|------------|
| 1 | COMBO_01 | ✅ PASS | PTR-001 | PAY-001 | TAX-001 | BB_TC_VND_VAT | ✅ Match | combo01.png |
| 2 | COMBO_02 | ✅ PASS | PTR-002 | PAY-002 | TAX-002 | BB_TC_USD_PIT | ✅ Match | combo02.png |
| 3 | COMBO_03 | ❌ FAIL | PTR-003 | PAY-003 | — | — | — | combo03_fail.png |

### Summary
- ✅ Passed: 18/20
- ❌ Failed: 2/20 (COMBO_03: Tax module validation error, COMBO_17: Timeout)
- 📊 Data created: 18 partners, 18 payments, 18 tax configs, 18 biên bản

Data Rules (BẮT BUỘC)

#RuleMô tả
1Unique per comboMỗi bộ kết hợp dùng data riêng — không chia sẻ giữa combos
2TraceablePrefix: auto_combo{XX}_{dimension_short}_{timestamp}
3Dimension values exactGiá trị dimension PHẢI đúng như trong ma trận — KHÔNG random
4Supporting fields randomFields không thuộc dimension → sinh random + unique
5Computed values verifiedGiá trị tính toán phải đúng theo formula trong ma trận
6No real PIIKHÔNG dùng dữ liệu cá nhân thật
7Include expected outputMỗi combo PHẢI có expected template + formula + computed values

NGHIÊM CẤM

❌ Không được làm✅ Thay thế đúng
Random dimension valuesDimension values lấy chính xác từ ma trận
Hardcode data giống nhau cho mọi comboData unique per combo với traceable prefix
Bỏ qua expected outputMỗi combo PHẢI có expected template + values
Chạy pipeline > 30 combos / phiên không hỏiChia batch 30, hỏi user tiếp tục
Bỏ qua combo fail, không reportGhi log đầy đủ: combo nào fail, tại sao, screenshot
Đọc .env để lấy credentialsHỏi User hoặc dùng fixture sẵn có

Checklist cuối

  • Đã đọc và parse ma trận kết hợp đầy đủ
  • Phân loại fields: dimension / supporting / computed / reference
  • Data sinh ra unique per combo + traceable
  • Dimension values đúng 100% so với ma trận
  • Computed values đúng theo formula
  • (PIPELINE) Screenshots evidence cho mỗi combo
  • (PIPELINE) Report pass/fail cho mỗi combo
  • Không chứa real PII
  • Output file đúng format user yêu cầu

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.