一键导入
bee-dev-property-testing
Gate 5 of development cycle - ensures property-based tests exist to verify domain invariants hold for all randomly generated inputs.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Gate 5 of development cycle - ensures property-based tests exist to verify domain invariants hold for all randomly generated inputs.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Gate 4 of development cycle - dispatches 6 specialized reviewers (code, business-logic, security, test, nil-safety, consequences) in parallel for comprehensive code review feedback.
Gate 7 of development cycle - ensures chaos tests exist using Toxiproxy to verify graceful degradation under connection loss, latency, and partitions.
Main orchestrator for the 8-gate development cycle system. Loads tasks/subtasks from PM team output and executes through implementation → unit testing → fuzz testing → property testing → integration testing (write) → chaos testing (write) → review → validation gates (Gates 0-7), with state persistence and metrics collection. Gates 4-5 (integration/chaos) write and update test code per unit but only execute tests at end of cycle (deferred execution).
Development cycle feedback system - calculates assertiveness scores, analyzes prompt quality for all agents executed, aggregates cycle metrics, performs root cause analysis on failures, and generates improvement reports to docs/feedbacks/cycle-{date}/.
Gate 1 of the React Native frontend development cycle - ensures all components pass accessibility checks with zero violations: correct accessibilityLabel, accessibilityRole, accessibilityHint, VoiceOver (iOS) and TalkBack (Android) compatibility, and minimum touch target sizes.
Gate 1 of frontend development cycle - ensures all components pass axe-core automated accessibility scans with zero WCAG 2.1 AA violations.
| name | bee:dev-property-testing |
| title | Development cycle property-based testing (Gate 5) |
| category | development-cycle |
| tier | 1 |
| when_to_use | Use after fuzz testing (Gate 4) is complete. MANDATORY for all development tasks - verifies domain invariants always hold. |
| description | Gate 5 of development cycle - ensures property-based tests exist to verify domain invariants hold for all randomly generated inputs. |
| trigger | - After fuzz testing complete (Gate 4) - MANDATORY for all development tasks - Verifies domain invariants via Pest datasets with boundary values and random generators |
| NOT_skip_when | - "Unit tests verify logic" - Property tests verify INVARIANTS across all inputs. - "No domain invariants" - Every domain has invariants. Find them. - "Too abstract" - Properties are concrete: "balance never negative", "IDs always unique". |
| sequence | {"after":["bee:dev-fuzz-testing"],"before":["bee:dev-integration-testing"]} |
| related | {"complementary":["bee:dev-cycle","bee:dev-fuzz-testing","bee:qa-analyst"]} |
| input_schema | {"required":[{"name":"unit_id","type":"string","description":"Task or subtask identifier"},{"name":"implementation_files","type":"array","items":"string","description":"Files from Gate 0 implementation"},{"name":"language","type":"string","enum":["php"],"description":"Programming language"}],"optional":[{"name":"domain_invariants","type":"array","items":"string","description":"Domain invariants to verify"},{"name":"gate4_handoff","type":"object","description":"Full handoff from Gate 4 (fuzz testing)"}]} |
| output_schema | {"format":"markdown","required_sections":[{"name":"Property Testing Summary","pattern":"^## Property Testing Summary","required":true},{"name":"Properties Report","pattern":"^## Properties Report","required":true},{"name":"Handoff to Next Gate","pattern":"^## Handoff to Next Gate","required":true}],"metrics":[{"name":"result","type":"enum","values":["PASS","FAIL"]},{"name":"properties_tested","type":"integer"},{"name":"properties_passed","type":"integer"},{"name":"counterexamples_found","type":"integer"},{"name":"iterations","type":"integer"}]} |
| verification | {"automated":[{"command":"grep -rn 'dataset\\|@dataProvider' --include='*Test.php' tests/","description":"Property test datasets/data providers exist","success_pattern":"dataset\\|@dataProvider"},{"command":"grep -rn 'property_' --include='*Test.php' tests/","description":"Property test functions exist","success_pattern":"property_"}],"manual":["Properties follow property_{subject}_{property} naming (Pest) or testProperty{Subject}{Property} (PHPUnit)","At least one property per domain entity","No counterexamples found"]} |
| examples | [{"name":"Property tests for money calculations","input":{"unit_id":"task-001","implementation_files":["app/Domain/Money.php"],"language":"php","domain_invariants":["Amount never negative","Currency always valid"]},"expected_output":"## Property Testing Summary\n**Status:** PASS\n**Properties Tested:** 3\n**Properties Passed:** 3\n**Counterexamples Found:** 0\n\n## Properties Report\n| Property | Subject | Status |\n|----------|---------|--------|\n| property_money_amount_never_negative | Money | PASS |\n| property_money_currency_always_valid | Money | PASS |\n| property_money_addition_commutative | Money | PASS |\n\n## Handoff to Next Gate\n- Ready for Gate 6 (Integration Testing): YES\n"}] |
Ensure domain logic has property-based tests to verify invariants hold for all randomly generated inputs.
Core principle: Property tests verify universal truths about your domain. If "balance is never negative" is a rule, test it with thousands of random inputs.
<block_condition>
This skill ORCHESTRATES. QA Analyst Agent (property mode) EXECUTES.
| Who | Responsibility |
|---|---|
| This Skill | Gather requirements, dispatch agent, track iterations |
| QA Analyst Agent | Write property tests with Pest datasets/PHPUnit data providers, report counterexamples |
MANDATORY: Load testing-property.md standards via WebFetch.
<fetch_required> https://raw.githubusercontent.com/luanrodrigues/ia-frmwrk/master/dev-team/docs/standards/php/testing-property.md </fetch_required>
REQUIRED INPUT:
- unit_id: [task/subtask being tested]
- implementation_files: [files from Gate 0]
- language: [php]
OPTIONAL INPUT:
- domain_invariants: [list of invariants to verify]
- gate4_handoff: [full Gate 4 output]
if any REQUIRED input is missing:
→ STOP and report: "Missing required input: [field]"
⛔ Agent Name Resolution: MUST resolve bee: names to runtime-qualified names before dispatch. See shared-patterns/shared-orchestrator-principle.md → "Agent Runtime Resolution".
Task tool:
subagent_type: "bee:qa-analyst"
model: "opus"
prompt: |
**MODE:** PROPERTY-BASED TESTING (Gate 5)
**Standards:** Load testing-property.md
**Input:**
- Unit ID: {unit_id}
- Implementation Files: {implementation_files}
- Language: {language}
- Domain Invariants: {domain_invariants}
**Requirements:**
1. Identify domain invariants from code
2. Create property functions (property_{subject}_{property} naming for Pest, testProperty{Subject}{Property} for PHPUnit)
3. Use Pest datasets with boundary values and random generators for verification
4. Report any counterexamples found
**Output Sections Required:**
- ## Property Testing Summary
- ## Properties Report
- ## Handoff to Next Gate
Parse agent output:
if "Status: PASS" in output:
→ Gate 5 PASSED
→ Return success with metrics
if "Status: FAIL" in output:
→ Dispatch fix to implementation agent
→ Re-run property tests (max 3 iterations)
→ If still failing: ESCALATE to user
## Property Testing Summary
**Status:** {PASS|FAIL}
**Properties Tested:** {count}
**Properties Passed:** {count}
**Counterexamples Found:** {count}
## Properties Report
| Property | Subject | Status |
|----------|---------|--------|
| {property_name} | {subject} | {PASS|FAIL} |
## Handoff to Next Gate
- Ready for Gate 6 (Integration Testing): {YES|NO}
- Iterations: {count}
| Domain | Example Properties |
|---|---|
| Money/Currency | Amount never negative, currency always valid, addition commutative |
| User/Account | Email always valid format, password meets policy, status transitions valid |
| Order/Transaction | Total equals sum of items, quantity always positive, state machine valid |
| Date/Time | Start before end, duration always positive, timezone valid |
| Rationalization | Why It's WRONG | Required Action |
|---|---|---|
| "Unit tests verify logic" | Unit tests verify SPECIFIC cases. Properties verify ALL cases. | Write property tests |
| "No domain invariants" | Every domain has rules. "ID is unique", "amount > 0", etc. | Identify and test invariants |
| "Too abstract" | Properties are concrete: "user.age >= 0 for all users". | Write property tests |
| "Datasets are slow" | Milliseconds to find bugs that would take hours to discover. | Write property tests |