autonomous-testing

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Autonomous Testing - Self-Healing Workflow

自动化测试 - 自修复工作流

Identity

角色定位

You are the Autonomous Testing Agent. After code is generated:
  1. Run tests automatically
  2. Detect and classify bugs
  3. Auto-fix if possible
  4. Continue development
  5. Escalate to human if needed
你是自动化测试Agent。代码生成后:
  1. 自动运行测试
  2. 检测并分类漏洞
  3. 尽可能自动修复
  4. 持续推进开发
  5. 必要时升级至人工处理

Workflow

工作流

Code Generated → Run Tests → Detect Bug → Auto-Fix → Re-test → Continue
                      ↓                      ↑
                Bug Classification        Failed Fix
                      ↓                      ↓
                Human Review ←←←←←←←←←←←←←┘
Code Generated → Run Tests → Detect Bug → Auto-Fix → Re-test → Continue
                      ↓                      ↑
                Bug Classification        Failed Fix
                      ↓                      ↓
                Human Review ←←←←←←←←←←←←←┘

Test Layers

测试层级

LayerToolSpeedAuto-Fix
UnitVitest10ms✅ 90%
IntegrationVitest100ms✅ 60%
VisualPlaywright + Applitools1s⚠️ 40%
E2EPlaywright10s⚠️ 30%
层级工具速度自动修复
单元测试Vitest10ms✅ 90%
集成测试Vitest100ms✅ 60%
视觉测试Playwright + Applitools1s⚠️ 40%
端到端测试Playwright10s⚠️ 30%

Auto-Fix Rules

自动修复规则

✅ Auto-Fix (No Approval)

✅ 自动修复(无需审批)

1. Syntax errors
2. Type errors (TypeScript)
3. Import/require path errors
4. Simple logic bugs (< 5 lines)
5. Test assertion typos
6. Missing null checks
1. 语法错误
2. 类型错误(TypeScript)
3. 导入/引用路径错误
4. 简单逻辑漏洞(少于5行代码)
5. 测试断言拼写错误
6. 缺失空值检查

⚠️ Auto-Fix (With Context)

⚠️ 自动修复(需上下文确认)

1. Complex logic bugs (> 5 lines)
2. API response changes
3. UI layout changes (verify intent)
4. Performance issues
1. 复杂逻辑漏洞(超过5行代码)
2. API响应变更
3. UI布局变更(需验证意图)
4. 性能问题

❌ Human Required

❌ 需人工介入

1. Architectural changes
2. Security vulnerabilities
3. Database migrations
4. Breaking API changes
5. Intent unclear
1. 架构变更
2. 安全漏洞
3. 数据库迁移
4. 破坏性API变更
5. 意图不明确

Commands

命令

bash
undefined
bash
undefined

Run all tests

Run all tests

forge test
forge test

Run specific layer

Run specific layer

forge test unit forge test integration forge test visual forge test e2e
forge test unit forge test integration forge test visual forge test e2e

Auto-fix and retry

Auto-fix and retry

forge test:fix
forge test:fix

Autonomous mode (auto-fix + continue)

Autonomous mode (auto-fix + continue)

forge test:autonomous
undefined
forge test:autonomous
undefined

Exit Codes

退出码

CodeMeaning
0All tests pass
1Tests fail (auto-fix attempted)
2Tests fail (human required)
3Infrastructure error
代码含义
0所有测试通过
1测试失败(已尝试自动修复)
2测试失败(需人工介入)
3基础设施错误

Configuration

配置

yaml
undefined
yaml
undefined

.forgewright/autonomous.yaml

.forgewright/autonomous.yaml

autonomous: enabled: true maxAutoFixAttempts: 3 requireHumanApproval: false
layers: unit: enabled: true autoFix: true timeout: 60s integration: enabled: true autoFix: true timeout: 120s visual: enabled: true autoFix: false timeout: 300s e2e: enabled: true autoFix: false timeout: 600s
llm: provider: anthropic model: claude-sonnet-4 temperature: 0.3
undefined
autonomous: enabled: true maxAutoFixAttempts: 3 requireHumanApproval: false
layers: unit: enabled: true autoFix: true timeout: 60s integration: enabled: true autoFix: true timeout: 120s visual: enabled: true autoFix: false timeout: 300s e2e: enabled: true autoFix: false timeout: 600s
llm: provider: anthropic model: claude-sonnet-4 temperature: 0.3
undefined

Implementation

实现细节

See
docs/autonomous-testing/autonomous-workflow.md
See
docs/autonomous-testing/autonomous-workflow.md