Agentic Test Engineer
/install agentic-test-engineer
\r \r
Agentic Test Engineer\r
\r
Overview\r
\r An AI-powered autonomous testing assistant that revolutionizes QA workflows. It generates comprehensive test suites from user stories and code, self-heals broken selectors using visual AI, detects and diagnoses flaky tests, and continuously maintains test coverage metrics — all with minimal human intervention.\r \r
Triggers\r
\r
- "generate tests for [feature/code]"\r
- "write unit tests for [function]"\r
- "self-heal my broken test"\r
- "find flaky tests in [project]"\r
- "check test coverage for [module]"\r
- "run E2E tests for [workflow]"\r
- "why is my test failing"\r
- "智能测试生成"\r
- "自愈测试修复"\r
- "测试覆盖率分析"\r \r
Workflow\r
\r
Step 1: Detect Context\r
\r Identify the testing scenario:\r
- Unit tests: Python, JavaScript, TypeScript, Java, Go functions\r
- Integration tests: API endpoints, database interactions, service meshes\r
- E2E tests: Browser workflows (Playwright, Cypress, Selenium)\r
- API tests: REST/GraphQL endpoints, contract testing\r
- Flaky test diagnosis: Test results history, timing issues, async race conditions\r
- Self-healing: Broken selectors, changed DOM, moved UI elements\r \r
Step 2: Test Generation\r
\r For test generation:\r
- Analyze code structure, user story, or API spec\r
- Select appropriate testing framework:\r
- Python: pytest, unittest\r
- JavaScript/TypeScript: Jest, Vitest, Playwright, Cypress\r
- Java: JUnit, TestNG\r
- Go: testing package, testify\r
- Generate comprehensive test cases:\r
- Happy path scenarios\r
- Edge cases and boundary conditions\r
- Error handling scenarios\r
- Negative test cases\r
- Include setup/teardown fixtures\r
- Add data-driven test parameters\r \r
Step 3: Self-Healing (When Triggered)\r
\r When a test breaks due to UI changes:\r
- Capture the failing selector/error message\r
- Use visual AI to identify the new element location\r
- Generate updated selector using multiple strategies:\r
- Text content matching\r
- Semantic role/labels\r
- Visual proximity to stable elements\r
- Shadow DOM traversal\r
- Validate the fix across related tests\r
- Log the healing action for audit trail\r \r
Step 4: Flaky Test Detection\r
\r
- Collect test execution history from CI/CD\r
- Analyze failure patterns:\r
- Timing issues (race conditions, async waits)\r
- Resource contention (DB connections, file locks)\r
- Environment instability\r
- Test interdependencies\r
- Generate diagnosis report with:\r
- Probability of flakiness\r
- Root cause analysis\r
- Recommended fixes (add explicit waits, mock external calls, etc.)\r \r
Step 5: Coverage Analysis\r
\r
- Parse code and existing test files\r
- Calculate line/branch/function coverage\r
- Identify untested code paths\r
- Suggest priority test cases for uncovered areas\r
- Generate coverage trend report\r \r
Input/Output Examples\r
\r
Example 1: Generate Unit Tests\r
\r Input:\r
Generate unit tests for this Python function:\r
def calculate_premium(age: int, health_score: float, coverage_amount: float) -> float:\r
if age \x3C 18 or age > 70:\r
raise ValueError("Age must be between 18 and 70")\r
base_rate = coverage_amount * 0.05\r
health_factor = 1.0 - (health_score / 100) * 0.3\r
return base_rate * health_factor\r
```\r
\r
**Output:**\r
```python\r
import pytest\r
from your_module import calculate_premium\r
\r
class TestCalculatePremium:\r
def test_happy_path(self):\r
result = calculate_premium(age=30, health_score=80, coverage_amount=100000)\r
assert 3000 \x3C= result \x3C= 5000\r
\r
def test_age_boundary_18_valid(self):\r
result = calculate_premium(age=18, health_score=50, coverage_amount=100000)\r
assert result == 100000 * 0.05 * (1.0 - 0.5 * 0.3)\r
\r
def test_age_boundary_70_valid(self):\r
result = calculate_premium(age=70, health_score=50, coverage_amount=100000)\r
assert isinstance(result, float)\r
\r
def test_age_too_young(self):\r
with pytest.raises(ValueError, match="Age must be between"):\r
calculate_premium(age=17, health_score=80, coverage_amount=100000)\r
\r
def test_age_too_old(self):\r
with pytest.raises(ValueError, match="Age must be between"):\r
calculate_premium(age=71, health_score=80, coverage_amount=100000)\r
\r
@pytest.mark.parametrize("health_score,expected_factor_range", [\r
(0, (0.97, 1.01)),\r
(50, (0.82, 0.88)),\r
(100, (0.69, 0.71)),\r
])\r
def test_health_factor_bounds(self, health_score, expected_factor_range):\r
result = calculate_premium(age=30, health_score=health_score, coverage_amount=100000)\r
lower, upper = expected_factor_range\r
assert lower * 5000 \x3C= result \x3C= upper * 5000\r
```\r
\r
### Example 2: Self-Healing a Broken Playwright Test\r
\r
**Input:**\r
```\r
My Playwright test is failing: Selector ".submit-button" not found.\r
The button text is "提交保单" now.\r
```\r
\r
**Output:**\r
```\r
🔧 Self-Healing Analysis:\r
- Original selector: ".submit-button"\r
- Issue: UI updated, element selector changed\r
- Healed selector strategy: text-content match\r
\r
Generated alternatives:\r
1. await page.getByRole('button', { name: '提交保单' }).click()\r
2. await page.locator('button[type="submit"]').click()\r
3. await page.getByText('提交保单').click()\r
\r
Recommended (most robust): Option 1\r
- Uses semantic role binding (survives CSS class changes)\r
- Language-aware (works with i18n updates)\r
```\r
\r
### Example 3: Flaky Test Diagnosis\r
\r
**Input:**\r
```\r
Diagnose why this test is flaky:\r
it('should load user dashboard', async () => {\r
const dashboard = await page.locator('.dashboard').waitFor();\r
const count = await dashboard.locator('.card').count();\r
expect(count).toBeGreaterThan(0);\r
});\r
```\r
\r
**Output:**\r
```\r
Flaky Test Report:\r
- Flakiness probability: 87% (HIGH)\r
- Root cause: Race condition between page load and element appearance\r
\r
Recommended fixes:\r
1. Replace implicit waitFor() with explicit wait:\r
await expect(page.locator('.dashboard')).toBeVisible({ timeout: 10000 })\r
\r
2. Add network idle wait:\r
await page.waitForLoadState('networkidle')\r
\r
3. Use data-testid for stability:\r
\x3Cdiv data-testid="user-dashboard" className="dashboard">...\x3C/div>\r
\r
4. Add retry wrapper for truly async cases:\r
await expect.poll(async () => {\r
return await page.locator('.card').count();\r
}, { timeout: 10000 }).toBeGreaterThan(0);\r
```\r
\r
## Key Capabilities\r
\r
| Capability | Description | Supported Frameworks |\r
|------------|-------------|---------------------|\r
| Test Generation | Generate tests from code/user stories | pytest, Jest, Vitest, JUnit, Playwright, Cypress |\r
| Self-Healing | Auto-fix broken selectors | Playwright, Cypress, Selenium |\r
| Flaky Test Detection | Diagnose intermittent failures | All major frameworks + CI logs |\r
| Coverage Analysis | Measure and report test coverage | Istanbul, pytest-cov, JaCoCo |\r
| API Contract Testing | Validate API schemas and responses | OpenAPI, Postman, Pact |\r
\r
## Best Practices\r
\r
1. **Always add `data-testid` attributes** to UI elements for stable selectors\r
2. **Use explicit waits** instead of `sleep()` — AI will recommend optimal wait strategies\r
3. **Keep tests isolated** — each test should be independent\r
4. **Parameterize test data** — use data-driven tests for variant coverage\r
5. **Review self-healed selectors** — AI suggestions should be human-verified before production\r
\r
## Notes\r
\r
- This skill generates test code only — it does not execute tests directly\r
- For CI/CD integration, combine with `ai-test-strategy-architect` skill\r
- Self-healing suggestions prioritize semantic selectors over CSS class selectors\r
- Coverage analysis requires access to test execution output files (JSON/XML format)\r
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install agentic-test-engineer - 安装完成后,直接呼叫该 Skill 的名称或使用
/agentic-test-engineer触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
Agentic Test Engineer 是什么?
AI-powered autonomous test generation and self-healing test maintenance. Generates unit/integration/E2E tests, detects flaky tests, auto-fixes broken selecto... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 106 次。
如何安装 Agentic Test Engineer?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install agentic-test-engineer」即可一键安装,无需额外配置。
Agentic Test Engineer 是免费的吗?
是的,Agentic Test Engineer 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Agentic Test Engineer 支持哪些平台?
Agentic Test Engineer 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Agentic Test Engineer?
由 lingfeng-19(@gechengling)开发并维护,当前版本 v1.0.0。