qa-skills 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +168 -0
- package/bin/cli.js +42 -0
- package/dist/agents/registry.d.ts +5 -0
- package/dist/agents/registry.d.ts.map +1 -0
- package/dist/agents/registry.js +101 -0
- package/dist/agents/registry.js.map +1 -0
- package/dist/agents/types.d.ts +9 -0
- package/dist/agents/types.d.ts.map +1 -0
- package/dist/agents/types.js +2 -0
- package/dist/agents/types.js.map +1 -0
- package/dist/dependencies.d.ts +21 -0
- package/dist/dependencies.d.ts.map +1 -0
- package/dist/dependencies.js +125 -0
- package/dist/dependencies.js.map +1 -0
- package/dist/installer.d.ts +25 -0
- package/dist/installer.d.ts.map +1 -0
- package/dist/installer.js +437 -0
- package/dist/installer.js.map +1 -0
- package/dist/scaffold.d.ts +27 -0
- package/dist/scaffold.d.ts.map +1 -0
- package/dist/scaffold.js +182 -0
- package/dist/scaffold.js.map +1 -0
- package/package.json +40 -0
- package/skills/qa-accessibility-test-writer/SKILL.md +127 -0
- package/skills/qa-accessibility-test-writer/references/axe-core-patterns.md +349 -0
- package/skills/qa-accessibility-test-writer/references/best-practices.md +184 -0
- package/skills/qa-accessibility-test-writer/references/wcag-tests.md +331 -0
- package/skills/qa-api-contract-curator/SKILL.md +104 -0
- package/skills/qa-api-contract-curator/references/breaking-changes.md +363 -0
- package/skills/qa-api-contract-curator/references/openapi-structure.md +404 -0
- package/skills/qa-browser-data-collector/SKILL.md +132 -0
- package/skills/qa-browser-data-collector/references/data-collection-checklist.md +91 -0
- package/skills/qa-browser-data-collector/references/playwright-mcp-patterns.md +113 -0
- package/skills/qa-bug-ticket-creator/SKILL.md +148 -0
- package/skills/qa-bug-ticket-creator/references/bug-report-format.md +149 -0
- package/skills/qa-bug-ticket-creator/references/severity-guide.md +81 -0
- package/skills/qa-bug-ticket-creator/templates/bug-ticket-template.md +39 -0
- package/skills/qa-changelog-analyzer/SKILL.md +134 -0
- package/skills/qa-changelog-analyzer/references/git-analysis-patterns.md +138 -0
- package/skills/qa-changelog-analyzer/references/impact-mapping.md +120 -0
- package/skills/qa-clickup-integration/SKILL.md +166 -0
- package/skills/qa-clickup-integration/references/api-patterns.md +102 -0
- package/skills/qa-clickup-integration/references/field-mapping.md +71 -0
- package/skills/qa-codeceptjs-writer/SKILL.md +136 -0
- package/skills/qa-codeceptjs-writer/references/best-practices.md +207 -0
- package/skills/qa-codeceptjs-writer/references/config.md +255 -0
- package/skills/qa-codeceptjs-writer/references/patterns.md +285 -0
- package/skills/qa-coverage-analyzer/SKILL.md +166 -0
- package/skills/qa-coverage-analyzer/references/best-practices.md +142 -0
- package/skills/qa-coverage-analyzer/references/coverage-dimensions.md +155 -0
- package/skills/qa-coverage-analyzer/references/tools.md +204 -0
- package/skills/qa-cypress-writer/SKILL.md +134 -0
- package/skills/qa-cypress-writer/references/assertions.md +121 -0
- package/skills/qa-cypress-writer/references/best-practices.md +82 -0
- package/skills/qa-cypress-writer/references/config.md +121 -0
- package/skills/qa-cypress-writer/references/patterns.md +170 -0
- package/skills/qa-data-factory/SKILL.md +126 -0
- package/skills/qa-data-factory/references/factory-patterns.md +164 -0
- package/skills/qa-data-factory/references/faker-guide.md +131 -0
- package/skills/qa-diagram-generator/SKILL.md +125 -0
- package/skills/qa-diagram-generator/references/c4-model.md +53 -0
- package/skills/qa-diagram-generator/references/charts.md +58 -0
- package/skills/qa-diagram-generator/references/class-diagram.md +85 -0
- package/skills/qa-diagram-generator/references/er-diagram.md +69 -0
- package/skills/qa-diagram-generator/references/flowchart.md +92 -0
- package/skills/qa-diagram-generator/references/from-screenshot.md +45 -0
- package/skills/qa-diagram-generator/references/gantt.md +49 -0
- package/skills/qa-diagram-generator/references/journey.md +50 -0
- package/skills/qa-diagram-generator/references/mindmap.md +75 -0
- package/skills/qa-diagram-generator/references/sequence.md +69 -0
- package/skills/qa-diagram-generator/references/state-diagram.md +56 -0
- package/skills/qa-discovery-interview/SKILL.md +182 -0
- package/skills/qa-discovery-interview/references/completeness-checklist.md +53 -0
- package/skills/qa-discovery-interview/references/conflict-patterns.md +101 -0
- package/skills/qa-discovery-interview/references/qa-categories.md +147 -0
- package/skills/qa-discovery-interview/templates/qa-brief-template.md +168 -0
- package/skills/qa-environment-checker/SKILL.md +142 -0
- package/skills/qa-environment-checker/references/dependency-matrix.md +101 -0
- package/skills/qa-environment-checker/references/health-checks.md +209 -0
- package/skills/qa-environment-checker/templates/env-readiness-template.md +64 -0
- package/skills/qa-flaky-detector/SKILL.md +153 -0
- package/skills/qa-flaky-detector/references/ci-analysis.md +140 -0
- package/skills/qa-flaky-detector/references/flaky-patterns.md +247 -0
- package/skills/qa-github-issues-enhanced/SKILL.md +175 -0
- package/skills/qa-github-issues-enhanced/references/issue-templates.md +425 -0
- package/skills/qa-github-issues-enhanced/references/label-taxonomy.md +130 -0
- package/skills/qa-github-issues-enhanced/references/workflow-patterns.md +188 -0
- package/skills/qa-httpx-writer/SKILL.md +138 -0
- package/skills/qa-httpx-writer/references/assertions.md +195 -0
- package/skills/qa-httpx-writer/references/best-practices.md +140 -0
- package/skills/qa-httpx-writer/references/config.md +212 -0
- package/skills/qa-httpx-writer/references/patterns.md +262 -0
- package/skills/qa-jest-writer/SKILL.md +131 -0
- package/skills/qa-jest-writer/references/assertions.md +125 -0
- package/skills/qa-jest-writer/references/best-practices.md +136 -0
- package/skills/qa-jest-writer/references/config.md +134 -0
- package/skills/qa-jest-writer/references/patterns.md +172 -0
- package/skills/qa-jira-integration/SKILL.md +135 -0
- package/skills/qa-jira-integration/references/api-patterns.md +143 -0
- package/skills/qa-jira-integration/references/field-mapping.md +79 -0
- package/skills/qa-jira-integration/references/xray-integration.md +85 -0
- package/skills/qa-jmeter-writer/SKILL.md +171 -0
- package/skills/qa-jmeter-writer/references/best-practices.md +157 -0
- package/skills/qa-jmeter-writer/references/config.md +204 -0
- package/skills/qa-jmeter-writer/references/patterns.md +242 -0
- package/skills/qa-junit5-writer/SKILL.md +157 -0
- package/skills/qa-junit5-writer/references/assertions.md +118 -0
- package/skills/qa-junit5-writer/references/config.md +97 -0
- package/skills/qa-junit5-writer/references/patterns.md +162 -0
- package/skills/qa-k6-writer/SKILL.md +155 -0
- package/skills/qa-k6-writer/references/best-practices.md +236 -0
- package/skills/qa-k6-writer/references/config.md +219 -0
- package/skills/qa-k6-writer/references/patterns.md +304 -0
- package/skills/qa-linear-integration/SKILL.md +137 -0
- package/skills/qa-linear-integration/references/api-patterns.md +249 -0
- package/skills/qa-linear-integration/references/field-mapping.md +121 -0
- package/skills/qa-locust-writer/SKILL.md +151 -0
- package/skills/qa-locust-writer/references/best-practices.md +126 -0
- package/skills/qa-locust-writer/references/config.md +170 -0
- package/skills/qa-locust-writer/references/patterns.md +235 -0
- package/skills/qa-manual-test-designer/SKILL.md +145 -0
- package/skills/qa-manual-test-designer/references/exploratory-charters.md +138 -0
- package/skills/qa-manual-test-designer/references/personas.md +146 -0
- package/skills/qa-manual-test-designer/templates/exploratory-charter-template.md +47 -0
- package/skills/qa-manual-test-designer/templates/test-case-template.md +31 -0
- package/skills/qa-mobile-test-writer/SKILL.md +144 -0
- package/skills/qa-mobile-test-writer/references/best-practices.md +214 -0
- package/skills/qa-mobile-test-writer/references/config.md +309 -0
- package/skills/qa-mobile-test-writer/references/patterns.md +304 -0
- package/skills/qa-nfr-analyst/SKILL.md +177 -0
- package/skills/qa-nfr-analyst/references/iso-25010-model.md +159 -0
- package/skills/qa-nfr-analyst/references/owasp-wstg-baseline.md +202 -0
- package/skills/qa-nfr-analyst/references/wcag-checklist.md +184 -0
- package/skills/qa-nfr-analyst/templates/owasp-checklist-template.md +89 -0
- package/skills/qa-nfr-analyst/templates/wcag-checklist-template.md +48 -0
- package/skills/qa-orchestrator/SKILL.md +132 -0
- package/skills/qa-orchestrator/references/handoff-chains.md +105 -0
- package/skills/qa-orchestrator/references/pipeline-modes.md +115 -0
- package/skills/qa-orchestrator/references/scheduler-rules.md +84 -0
- package/skills/qa-pact-writer/SKILL.md +133 -0
- package/skills/qa-pact-writer/references/best-practices.md +100 -0
- package/skills/qa-pact-writer/references/config.md +135 -0
- package/skills/qa-pact-writer/references/patterns.md +161 -0
- package/skills/qa-plan-creator/SKILL.md +139 -0
- package/skills/qa-plan-creator/references/introduction-plan.md +43 -0
- package/skills/qa-plan-creator/references/migration-plan.md +44 -0
- package/skills/qa-plan-creator/references/onboarding-plan.md +46 -0
- package/skills/qa-plan-creator/references/performance-plan.md +44 -0
- package/skills/qa-plan-creator/references/regression-plan.md +45 -0
- package/skills/qa-plan-creator/references/release-plan.md +45 -0
- package/skills/qa-plan-creator/references/sprint-plan.md +44 -0
- package/skills/qa-plan-creator/references/test-plan.md +59 -0
- package/skills/qa-plan-creator/references/uat-plan.md +43 -0
- package/skills/qa-plan-creator/templates/checklist-template.md +36 -0
- package/skills/qa-plan-creator/templates/regression-checklist-template.md +49 -0
- package/skills/qa-plan-creator/templates/release-checklist-template.md +46 -0
- package/skills/qa-plan-creator/templates/test-plan-template.md +74 -0
- package/skills/qa-playwright-py-writer/SKILL.md +156 -0
- package/skills/qa-playwright-py-writer/references/best-practices.md +194 -0
- package/skills/qa-playwright-py-writer/references/config.md +195 -0
- package/skills/qa-playwright-py-writer/references/patterns.md +212 -0
- package/skills/qa-playwright-ts-writer/SKILL.md +151 -0
- package/skills/qa-playwright-ts-writer/references/assertions.md +109 -0
- package/skills/qa-playwright-ts-writer/references/best-practices.md +191 -0
- package/skills/qa-playwright-ts-writer/references/config.md +144 -0
- package/skills/qa-playwright-ts-writer/references/patterns.md +171 -0
- package/skills/qa-pytest-writer/SKILL.md +145 -0
- package/skills/qa-pytest-writer/references/assertions.md +149 -0
- package/skills/qa-pytest-writer/references/best-practices.md +97 -0
- package/skills/qa-pytest-writer/references/config.md +176 -0
- package/skills/qa-pytest-writer/references/patterns.md +251 -0
- package/skills/qa-qase-integration/SKILL.md +149 -0
- package/skills/qa-qase-integration/references/api-reference.md +354 -0
- package/skills/qa-qase-integration/references/ci-integration.md +196 -0
- package/skills/qa-qase-integration/references/field-mapping.md +157 -0
- package/skills/qa-requirements-generator/SKILL.md +152 -0
- package/skills/qa-requirements-generator/references/iso-29148-structure.md +153 -0
- package/skills/qa-requirements-generator/references/requirement-patterns.md +278 -0
- package/skills/qa-rest-assured-writer/SKILL.md +137 -0
- package/skills/qa-rest-assured-writer/references/best-practices.md +50 -0
- package/skills/qa-rest-assured-writer/references/config.md +124 -0
- package/skills/qa-rest-assured-writer/references/patterns.md +192 -0
- package/skills/qa-risk-analyzer/SKILL.md +158 -0
- package/skills/qa-risk-analyzer/references/impact-analysis.md +133 -0
- package/skills/qa-risk-analyzer/references/risk-factors.md +123 -0
- package/skills/qa-robot-framework-writer/SKILL.md +147 -0
- package/skills/qa-robot-framework-writer/references/best-practices.md +249 -0
- package/skills/qa-robot-framework-writer/references/config.md +204 -0
- package/skills/qa-robot-framework-writer/references/libraries.md +273 -0
- package/skills/qa-robot-framework-writer/references/patterns.md +216 -0
- package/skills/qa-security-test-writer/SKILL.md +123 -0
- package/skills/qa-security-test-writer/references/best-practices.md +155 -0
- package/skills/qa-security-test-writer/references/owasp-top10.md +331 -0
- package/skills/qa-security-test-writer/references/zap-config.md +258 -0
- package/skills/qa-selenium-java-writer/SKILL.md +143 -0
- package/skills/qa-selenium-java-writer/references/best-practices.md +59 -0
- package/skills/qa-selenium-java-writer/references/config.md +143 -0
- package/skills/qa-selenium-java-writer/references/patterns.md +170 -0
- package/skills/qa-selenium-py-writer/SKILL.md +150 -0
- package/skills/qa-selenium-py-writer/references/best-practices.md +175 -0
- package/skills/qa-selenium-py-writer/references/config.md +224 -0
- package/skills/qa-selenium-py-writer/references/patterns.md +255 -0
- package/skills/qa-shortcut-integration/SKILL.md +143 -0
- package/skills/qa-shortcut-integration/references/api-patterns.md +126 -0
- package/skills/qa-shortcut-integration/references/field-mapping.md +66 -0
- package/skills/qa-spec-auditor/SKILL.md +162 -0
- package/skills/qa-spec-auditor/references/audit-checklist.md +144 -0
- package/skills/qa-spec-auditor/references/drift-patterns.md +207 -0
- package/skills/qa-spec-writer/SKILL.md +143 -0
- package/skills/qa-spec-writer/references/gherkin-guide.md +253 -0
- package/skills/qa-spec-writer/references/specification-patterns.md +274 -0
- package/skills/qa-spring-test-writer/SKILL.md +170 -0
- package/skills/qa-spring-test-writer/references/best-practices.md +57 -0
- package/skills/qa-spring-test-writer/references/config.md +179 -0
- package/skills/qa-spring-test-writer/references/patterns.md +235 -0
- package/skills/qa-supertest-writer/SKILL.md +150 -0
- package/skills/qa-supertest-writer/references/assertions.md +192 -0
- package/skills/qa-supertest-writer/references/best-practices.md +102 -0
- package/skills/qa-supertest-writer/references/config.md +166 -0
- package/skills/qa-supertest-writer/references/patterns.md +242 -0
- package/skills/qa-task-creator/SKILL.md +142 -0
- package/skills/qa-task-creator/references/linking-patterns.md +127 -0
- package/skills/qa-task-creator/references/task-types.md +169 -0
- package/skills/qa-task-creator/templates/task-template.md +24 -0
- package/skills/qa-test-doc-compiler/SKILL.md +114 -0
- package/skills/qa-test-doc-compiler/references/agile-tailoring.md +220 -0
- package/skills/qa-test-doc-compiler/references/iso-29119-3-documents.md +302 -0
- package/skills/qa-test-healer/SKILL.md +101 -0
- package/skills/qa-test-healer/references/diagnosis-patterns.md +142 -0
- package/skills/qa-test-healer/references/fix-strategies.md +177 -0
- package/skills/qa-test-reporter/SKILL.md +130 -0
- package/skills/qa-test-reporter/references/best-practices.md +162 -0
- package/skills/qa-test-reporter/references/iso-29119-reports.md +236 -0
- package/skills/qa-test-reporter/references/report-formats.md +287 -0
- package/skills/qa-test-reviewer/SKILL.md +142 -0
- package/skills/qa-test-reviewer/references/anti-patterns.md +268 -0
- package/skills/qa-test-reviewer/references/review-checklist.md +93 -0
- package/skills/qa-test-strategy/SKILL.md +133 -0
- package/skills/qa-test-strategy/references/entry-exit-criteria.md +176 -0
- package/skills/qa-test-strategy/references/risk-matrix.md +102 -0
- package/skills/qa-test-strategy/references/testing-types.md +143 -0
- package/skills/qa-testcase-from-docs/SKILL.md +161 -0
- package/skills/qa-testcase-from-docs/references/test-case-format.md +196 -0
- package/skills/qa-testcase-from-docs/references/test-design-techniques.md +126 -0
- package/skills/qa-testcase-from-docs/templates/test-case-template.md +31 -0
- package/skills/qa-testcase-from-ui/SKILL.md +109 -0
- package/skills/qa-testcase-from-ui/references/ui-element-patterns.md +126 -0
- package/skills/qa-testcase-from-ui/references/visual-analysis-guide.md +146 -0
- package/skills/qa-testcase-from-ui/templates/test-case-template.md +31 -0
- package/skills/qa-visual-regression-writer/SKILL.md +175 -0
- package/skills/qa-visual-regression-writer/references/best-practices.md +154 -0
- package/skills/qa-visual-regression-writer/references/config.md +220 -0
- package/skills/qa-visual-regression-writer/references/patterns.md +213 -0
- package/skills/qa-vitest-writer/SKILL.md +141 -0
- package/skills/qa-vitest-writer/references/assertions.md +105 -0
- package/skills/qa-vitest-writer/references/best-practices.md +62 -0
- package/skills/qa-vitest-writer/references/config.md +127 -0
- package/skills/qa-vitest-writer/references/patterns.md +141 -0
- package/skills/qa-webdriverio-writer/SKILL.md +145 -0
- package/skills/qa-webdriverio-writer/references/best-practices.md +176 -0
- package/skills/qa-webdriverio-writer/references/config.md +240 -0
- package/skills/qa-webdriverio-writer/references/patterns.md +269 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Git Diff Impact Analysis Patterns
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Impact analysis maps git changes to affected modules, tests, and regression scope. Use this to prioritize testing and scope regression sets.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. Parsing Git Diff
|
|
10
|
+
|
|
11
|
+
### Commands
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Files changed in branch vs base
|
|
15
|
+
git diff --name-only base_branch..HEAD
|
|
16
|
+
|
|
17
|
+
# Files changed in last commit
|
|
18
|
+
git diff --name-only HEAD~1..HEAD
|
|
19
|
+
|
|
20
|
+
# Files changed in PR
|
|
21
|
+
git diff --name-only origin/main...HEAD
|
|
22
|
+
|
|
23
|
+
# With change stats
|
|
24
|
+
git diff --stat base_branch..HEAD
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Output Structure
|
|
28
|
+
|
|
29
|
+
- **Added:** New files (higher risk if untested)
|
|
30
|
+
- **Modified:** Changed files (map to modules)
|
|
31
|
+
- **Deleted:** Removed files (update test mapping)
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 2. File → Module Mapping
|
|
36
|
+
|
|
37
|
+
### Strategies
|
|
38
|
+
|
|
39
|
+
| Strategy | When to Use | How |
|
|
40
|
+
|----------|-------------|-----|
|
|
41
|
+
| **Directory** | Clear package structure | `src/auth/` → `auth` module |
|
|
42
|
+
| **Package/Import** | JS/TS/Python | Parse `package.json`, `__init__.py`, imports |
|
|
43
|
+
| **Config** | Custom mapping | `impact-mapping.json` or similar |
|
|
44
|
+
| **Convention** | Monorepo | `packages/auth`, `apps/web` |
|
|
45
|
+
|
|
46
|
+
### Example Mapping
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
src/auth/login.ts → auth
|
|
50
|
+
src/auth/session.ts → auth
|
|
51
|
+
src/api/users.ts → api
|
|
52
|
+
tests/auth/login.spec.ts → auth (test)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## 3. Affected Tests
|
|
58
|
+
|
|
59
|
+
### Coverage-Based
|
|
60
|
+
|
|
61
|
+
- Use coverage report: which tests cover changed files?
|
|
62
|
+
- Tools: Istanbul `--reporter json`, JaCoCo, coverage.py
|
|
63
|
+
- Map: changed file → tests that execute it
|
|
64
|
+
|
|
65
|
+
### Naming/Path-Based
|
|
66
|
+
|
|
67
|
+
- Convention: `tests/<module>/` or `<module>.spec.ts`
|
|
68
|
+
- Changed `auth/login.ts` → run `tests/auth/*` or `**/auth*.spec.ts`
|
|
69
|
+
|
|
70
|
+
### Import-Based
|
|
71
|
+
|
|
72
|
+
- Parse test files for imports of changed modules
|
|
73
|
+
- Grep: `import.*from.*auth` in test files
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## 4. Downstream Impact
|
|
78
|
+
|
|
79
|
+
### Dependencies
|
|
80
|
+
|
|
81
|
+
- **Import graph:** Who imports changed files?
|
|
82
|
+
- **API consumers:** If changed file exports API, find callers
|
|
83
|
+
- **Database:** Schema changes → migration tests, integration tests
|
|
84
|
+
|
|
85
|
+
### Patterns
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# Find files importing changed module
|
|
89
|
+
grep -r "from.*auth" src/ tests/
|
|
90
|
+
|
|
91
|
+
# Find API consumers (if OpenAPI available)
|
|
92
|
+
# Cross-reference with qa-api-contract-curator
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## 5. Regression Scope
|
|
98
|
+
|
|
99
|
+
### Suggested Set
|
|
100
|
+
|
|
101
|
+
1. **Direct:** Tests for changed modules (from mapping)
|
|
102
|
+
2. **Integration:** Tests that use changed APIs/components
|
|
103
|
+
3. **Smoke:** Critical path tests (from qa-test-strategy)
|
|
104
|
+
4. **Optional:** Full suite if risk > threshold
|
|
105
|
+
|
|
106
|
+
### Output Format
|
|
107
|
+
|
|
108
|
+
```markdown
|
|
109
|
+
## Regression Scope for [Branch/PR]
|
|
110
|
+
|
|
111
|
+
### Must Run (High Impact)
|
|
112
|
+
- tests/auth/login.spec.ts
|
|
113
|
+
- tests/auth/session.spec.ts
|
|
114
|
+
- tests/api/users.integration.spec.ts
|
|
115
|
+
|
|
116
|
+
### Should Run (Medium Impact)
|
|
117
|
+
- tests/checkout/flow.spec.ts
|
|
118
|
+
|
|
119
|
+
### Optional (Low Impact)
|
|
120
|
+
- Full E2E suite
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## 6. Edge Cases
|
|
126
|
+
|
|
127
|
+
| Case | Handling |
|
|
128
|
+
|------|----------|
|
|
129
|
+
| **New file** | No change frequency; use complexity + criticality |
|
|
130
|
+
| **Config only** | Lower risk; may affect env-specific tests |
|
|
131
|
+
| **Test file changed** | Include in regression; flag for review |
|
|
132
|
+
| **Generated code** | Exclude or treat as low risk |
|
|
133
|
+
| **Merge conflict resolution** | Re-analyze after merge |
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Risk Factor Calculation Methods
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Risk factors feed into the formula: **Risk = Complexity × ChangeFrequency × (1 - TestCoverage)**. Each factor should be normalized to a 0–1 scale for consistent scoring.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. Code Complexity
|
|
10
|
+
|
|
11
|
+
### Cyclomatic Complexity
|
|
12
|
+
|
|
13
|
+
| Tool | Language | Command / Config |
|
|
14
|
+
|------|----------|------------------|
|
|
15
|
+
| **ESLint** | JS/TS | `complexity` rule; `cyclomatic-complexity` |
|
|
16
|
+
| **radon** | Python | `radon cc -a -s path` |
|
|
17
|
+
| **SonarQube** | Multi | Complexity metric per file |
|
|
18
|
+
| **Checkstyle** | Java | `CyclomaticComplexity` |
|
|
19
|
+
|
|
20
|
+
### Normalization (0–1)
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
normalized = min(1, raw_complexity / threshold)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
- Typical threshold: 10 (McCabe); high = 15+
|
|
27
|
+
- Scale: 0 = trivial, 1 = very complex
|
|
28
|
+
|
|
29
|
+
### Alternative: Coupling
|
|
30
|
+
|
|
31
|
+
- **Afferent coupling (Ca):** Incoming dependencies
|
|
32
|
+
- **Efferent coupling (Ce):** Outgoing dependencies
|
|
33
|
+
- **Instability:** Ce / (Ca + Ce) — higher = more change-prone
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 2. Change Frequency
|
|
38
|
+
|
|
39
|
+
### Git History
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Commits per file (last N commits)
|
|
43
|
+
git log --follow --format=format: --name-only -n 100 | sort | uniq -c | sort -rn
|
|
44
|
+
|
|
45
|
+
# Per directory/module
|
|
46
|
+
git log --follow --format=format: --name-only -n 100 -- path/to/module
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Normalization (0–1)
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
normalized = min(1, commit_count / max_commits_in_repo)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
- `max_commits_in_repo` = highest commit count among analyzed files
|
|
56
|
+
- Higher = more frequently changed = higher risk
|
|
57
|
+
|
|
58
|
+
### Time Windows
|
|
59
|
+
|
|
60
|
+
- **Sprint:** Last 2 weeks
|
|
61
|
+
- **Release:** Last 4–8 weeks
|
|
62
|
+
- **All time:** Full history (use for baseline)
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## 3. Test Coverage
|
|
67
|
+
|
|
68
|
+
### Source
|
|
69
|
+
|
|
70
|
+
- **qa-coverage-analyzer** output (Istanbul, JaCoCo, coverage.py)
|
|
71
|
+
- Line coverage or branch coverage per file/module
|
|
72
|
+
- Already 0–1 (e.g., 0.85 = 85%)
|
|
73
|
+
|
|
74
|
+
### In Formula
|
|
75
|
+
|
|
76
|
+
- `(1 - TestCoverage)` — low coverage increases risk
|
|
77
|
+
- Coverage = 1 → factor = 0 (no coverage risk)
|
|
78
|
+
- Coverage = 0 → factor = 1 (full coverage risk)
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 4. Defect History (Adjustment)
|
|
83
|
+
|
|
84
|
+
### Source
|
|
85
|
+
|
|
86
|
+
- **Memory MCP:** Past bugs per module/component
|
|
87
|
+
- Jira/issue tracker: Bugs linked to files/modules
|
|
88
|
+
- Manual tagging in config
|
|
89
|
+
|
|
90
|
+
### Application
|
|
91
|
+
|
|
92
|
+
- **Multiplier:** e.g., `1 + (defect_count / 10)` — more defects = higher risk
|
|
93
|
+
- **Additive:** Add fixed points for "defect-prone" modules
|
|
94
|
+
- Use as ranking adjustment, not primary factor
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## 5. Business Criticality
|
|
99
|
+
|
|
100
|
+
### Levels
|
|
101
|
+
|
|
102
|
+
| Level | Examples | Weight |
|
|
103
|
+
|-------|----------|--------|
|
|
104
|
+
| **Critical** | Payment, auth, core flows | 1.5–2.0 |
|
|
105
|
+
| **High** | Checkout, user profile | 1.2–1.5 |
|
|
106
|
+
| **Medium** | Search, filters | 1.0 |
|
|
107
|
+
| **Low** | Help, static content | 0.7–0.9 |
|
|
108
|
+
|
|
109
|
+
### Application
|
|
110
|
+
|
|
111
|
+
- Multiply final risk score by criticality weight
|
|
112
|
+
- Requires stakeholder input or config file
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Combined Risk Score
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
base_risk = Complexity × ChangeFrequency × (1 - TestCoverage)
|
|
120
|
+
adjusted_risk = base_risk × DefectMultiplier × CriticalityWeight
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Rank modules/features by `adjusted_risk` descending.
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: qa-robot-framework-writer
|
|
3
|
+
description: Generate Robot Framework tests for E2E, acceptance testing, and RPA with keyword-driven human-readable syntax, SeleniumLibrary, BrowserLibrary, and RequestsLibrary.
|
|
4
|
+
output_dir: tests/e2e
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# QA Robot Framework Writer
|
|
8
|
+
|
|
9
|
+
## Purpose
|
|
10
|
+
|
|
11
|
+
Write Robot Framework tests from test case specifications. Transform structured test cases (from qa-testcase-from-docs, qa-manual-test-designer, qa-testcase-from-ui, or specs) into executable `.robot` files with keyword-driven syntax, resource files, and proper configuration.
|
|
12
|
+
|
|
13
|
+
## Trigger Phrases
|
|
14
|
+
|
|
15
|
+
- "Write Robot Framework tests for [feature/flow]"
|
|
16
|
+
- "Generate Robot Framework E2E tests from test cases"
|
|
17
|
+
- "Create Robot Framework acceptance tests"
|
|
18
|
+
- "Add Robot Framework tests with SeleniumLibrary"
|
|
19
|
+
- "Robot Framework tests for [URL/flow]"
|
|
20
|
+
- "Robot Framework API tests with RequestsLibrary"
|
|
21
|
+
- "Robot Framework RPA automation for [task]"
|
|
22
|
+
- "BrowserLibrary Playwright tests in Robot Framework"
|
|
23
|
+
- "Data-driven Robot Framework tests"
|
|
24
|
+
- "BDD-style Robot Framework tests"
|
|
25
|
+
|
|
26
|
+
## Key Features
|
|
27
|
+
|
|
28
|
+
| Feature | Description |
|
|
29
|
+
| ------- | ----------- |
|
|
30
|
+
| **Keyword-driven** | Human-readable keywords; business logic in reusable keywords |
|
|
31
|
+
| **Human-readable syntax** | Plain-text, tab-separated; no programming required for basic tests |
|
|
32
|
+
| **SeleniumLibrary** | Browser automation (Open Browser, Input Text, Click Element) |
|
|
33
|
+
| **BrowserLibrary** | Playwright-based modern browser automation |
|
|
34
|
+
| **RequestsLibrary** | API testing (GET, POST, PUT, DELETE) |
|
|
35
|
+
| **Built-in data-driven** | FOR loops, template tests, variable tables |
|
|
36
|
+
| **Variable support** | `*** Variables ***`, variable files, `${VAR}` syntax |
|
|
37
|
+
| **Extensible via Python** | Custom libraries, listener APIs |
|
|
38
|
+
|
|
39
|
+
## Test Types
|
|
40
|
+
|
|
41
|
+
| Type | Scope | Approach |
|
|
42
|
+
|------|-------|----------|
|
|
43
|
+
| **E2E web** | Full user flows, browser interactions | SeleniumLibrary or BrowserLibrary |
|
|
44
|
+
| **Acceptance** | BDD-style Given/When/Then | Gherkin-like keywords |
|
|
45
|
+
| **RPA** | Desktop/file/process automation | RPA Framework, Process, OperatingSystem |
|
|
46
|
+
| **API** | REST endpoints | RequestsLibrary |
|
|
47
|
+
|
|
48
|
+
## Workflow
|
|
49
|
+
|
|
50
|
+
1. **Read test cases** — From specs, requirements, or manual test designs
|
|
51
|
+
2. **Generate .robot files** — Produce `{feature}.robot` with test cases and keywords
|
|
52
|
+
3. **Add resource files** — Shared keywords in `resources/*.robot`
|
|
53
|
+
4. **Configure** — Variable files, output dir, listeners, CLI options
|
|
54
|
+
|
|
55
|
+
## Context7 MCP
|
|
56
|
+
|
|
57
|
+
Use **Context7 MCP** for Robot Framework documentation when:
|
|
58
|
+
- Library keyword syntax (SeleniumLibrary, BrowserLibrary, RequestsLibrary) is uncertain
|
|
59
|
+
- Variable scope, FOR loops, or template syntax needs verification
|
|
60
|
+
- Resource file import or variable file format requires reference
|
|
61
|
+
|
|
62
|
+
## Key Patterns
|
|
63
|
+
|
|
64
|
+
| Pattern | Usage |
|
|
65
|
+
| ------- | ----- |
|
|
66
|
+
| `*** Settings ***` | Library imports, resource imports, suite/test setup |
|
|
67
|
+
| `*** Variables ***` | Suite-level variables |
|
|
68
|
+
| `*** Test Cases ***` | Test case definitions |
|
|
69
|
+
| `*** Keywords ***` | Reusable keyword definitions |
|
|
70
|
+
| Given/When/Then | BDD-style keyword naming |
|
|
71
|
+
| FOR loops | `FOR ${item} IN @{list}` |
|
|
72
|
+
| IF/ELSE | `IF condition ... ELSE ...` |
|
|
73
|
+
| TRY/EXCEPT | Error handling in keywords |
|
|
74
|
+
| Template tests | Data-driven via `[Template]` |
|
|
75
|
+
| `[Documentation]` | Test/keyword documentation |
|
|
76
|
+
| `[Tags]` | Test categorization |
|
|
77
|
+
|
|
78
|
+
## Libraries
|
|
79
|
+
|
|
80
|
+
| Library | Purpose | Key Keywords |
|
|
81
|
+
| ------- | ------- | ------------ |
|
|
82
|
+
| **SeleniumLibrary** | Browser (Selenium) | Open Browser, Input Text, Click Element, Get Title, Close Browser |
|
|
83
|
+
| **BrowserLibrary** | Browser (Playwright) | New Browser, Click, Fill Text, Get Text, Close Browser |
|
|
84
|
+
| **RequestsLibrary** | API | GET, POST, PUT, DELETE, Create Session, Status Should Be |
|
|
85
|
+
| **BuiltIn** | Core | Log, Should Be Equal, Run Keyword If, Fail, Sleep |
|
|
86
|
+
| **Collections** | Lists/dicts | Get From List, Append To List, Dictionary Should Contain Key |
|
|
87
|
+
| **String** | String ops | Get Length, Should Contain, Replace String |
|
|
88
|
+
| **DateTime** | Date/time | Get Current Date, Add Time To Date |
|
|
89
|
+
|
|
90
|
+
## File Naming
|
|
91
|
+
|
|
92
|
+
- `{feature}.robot` — Test files (e.g., `login.robot`, `checkout.robot`)
|
|
93
|
+
- `resources/*.robot` — Resource files for shared keywords (e.g., `resources/common.robot`)
|
|
94
|
+
- `variables.py` or `variables.robot` — Variable files for environment/config
|
|
95
|
+
|
|
96
|
+
## Scope
|
|
97
|
+
|
|
98
|
+
**Can do (autonomous):**
|
|
99
|
+
- Generate Robot Framework tests from test case specs
|
|
100
|
+
- Create .robot files with Settings, Variables, Test Cases, Keywords
|
|
101
|
+
- Add resource files for shared keywords
|
|
102
|
+
- Use SeleniumLibrary, BrowserLibrary, RequestsLibrary as appropriate
|
|
103
|
+
- Apply BDD-style Given/When/Then, data-driven (FOR, template), TRY/EXCEPT
|
|
104
|
+
- Configure variable files, output dir, basic CLI options
|
|
105
|
+
- Call qa-diagram-generator for test flow diagrams if needed
|
|
106
|
+
- Use Context7 MCP for Robot Framework docs
|
|
107
|
+
|
|
108
|
+
**Cannot do (requires confirmation):**
|
|
109
|
+
- Change production code to satisfy tests
|
|
110
|
+
- Add tests for requirements not in source documents
|
|
111
|
+
- Override project-level Robot config without approval
|
|
112
|
+
- Install new libraries not in project dependencies
|
|
113
|
+
|
|
114
|
+
**Will not do (out of scope):**
|
|
115
|
+
- Execute tests (user runs `robot tests/` or `robot -d output tests/`)
|
|
116
|
+
- Write Playwright/Cypress TypeScript tests (use qa-playwright-ts-writer, qa-cypress-writer)
|
|
117
|
+
- Modify CI/CD pipelines
|
|
118
|
+
|
|
119
|
+
## References
|
|
120
|
+
|
|
121
|
+
- `references/patterns.md` — Keyword-driven, BDD, data-driven, resource files, variable files
|
|
122
|
+
- `references/libraries.md` — SeleniumLibrary, BrowserLibrary, RequestsLibrary, BuiltIn, Collections
|
|
123
|
+
- `references/config.md` — CLI options, variable files, output dir, listeners
|
|
124
|
+
- `references/best-practices.md` — Keyword naming, resource organization, variable scope, test independence
|
|
125
|
+
|
|
126
|
+
## Quality Checklist
|
|
127
|
+
|
|
128
|
+
- [ ] Tests match test case steps and expected results
|
|
129
|
+
- [ ] Keywords are reusable and well-named (Given/When/Then where appropriate)
|
|
130
|
+
- [ ] No hardcoded secrets or sensitive data (use variables)
|
|
131
|
+
- [ ] Resource files used for shared logic; no duplication
|
|
132
|
+
- [ ] Proper teardown (Close Browser, Delete All Sessions) in suite/test teardown
|
|
133
|
+
- [ ] File naming follows `{feature}.robot` convention
|
|
134
|
+
- [ ] [Documentation] and [Tags] applied for traceability
|
|
135
|
+
- [ ] Variable scope appropriate (suite vs test vs keyword)
|
|
136
|
+
|
|
137
|
+
## Troubleshooting
|
|
138
|
+
|
|
139
|
+
| Symptom | Likely Cause | Fix |
|
|
140
|
+
| ------- | ------------ | --- |
|
|
141
|
+
| Keyword not found | Library not imported, typo | Add `Library LibraryName` in Settings; check keyword spelling |
|
|
142
|
+
| Variable not defined | Scope or variable file | Define in Variables section or variable file; check `${VAR}` syntax |
|
|
143
|
+
| Element not found | Selector, timing | Use Wait Until Element Is Visible; verify locator (id, xpath, css) |
|
|
144
|
+
| Resource import fails | Path, file missing | Use relative path from test file; ensure resource exists |
|
|
145
|
+
| API test fails | Session, URL | Create Session before requests; verify base URL |
|
|
146
|
+
| Browser not opening | Driver, browser binary | Install chromedriver/geckodriver; or use BrowserLibrary (bundled) |
|
|
147
|
+
| FOR loop syntax error | Indentation, IN RANGE | Use 4+ spaces between FOR items; check `IN` vs `IN RANGE` |
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
# Robot Framework Best Practices
|
|
2
|
+
|
|
3
|
+
## Keyword Naming
|
|
4
|
+
|
|
5
|
+
### Use Descriptive, Action-Oriented Names
|
|
6
|
+
|
|
7
|
+
| Good | Avoid |
|
|
8
|
+
| ---- | ----- |
|
|
9
|
+
| `User Clicks Login Button` | `Click1` |
|
|
10
|
+
| `Verify Order Total Matches Cart` | `Check` |
|
|
11
|
+
| `Navigate To Checkout Page` | `Go` |
|
|
12
|
+
| `Enter Valid Credentials` | `Do Login` |
|
|
13
|
+
|
|
14
|
+
### BDD-Style (Given/When/Then)
|
|
15
|
+
|
|
16
|
+
- **Given** — Preconditions, setup
|
|
17
|
+
- **When** — Actions, user/system behavior
|
|
18
|
+
- **Then** — Assertions, expected outcomes
|
|
19
|
+
- **And** — Additional steps in same phase
|
|
20
|
+
|
|
21
|
+
```robot
|
|
22
|
+
*** Keywords ***
|
|
23
|
+
Given User Is On Login Page
|
|
24
|
+
Open Browser ${LOGIN_URL} ${BROWSER}
|
|
25
|
+
Title Should Be Login
|
|
26
|
+
|
|
27
|
+
When User Enters Valid Credentials
|
|
28
|
+
Input Text id=username ${VALID_USER}
|
|
29
|
+
Input Password id=password ${VALID_PASS}
|
|
30
|
+
Click Button id=login
|
|
31
|
+
|
|
32
|
+
Then User Should See Dashboard
|
|
33
|
+
Wait Until Location Contains /dashboard
|
|
34
|
+
Page Should Contain Welcome
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### One Logical Action Per Keyword
|
|
38
|
+
|
|
39
|
+
Keep keywords focused. Avoid "god keywords" that do too much:
|
|
40
|
+
|
|
41
|
+
```robot
|
|
42
|
+
# Good: Single responsibility
|
|
43
|
+
Enter Username ${user}
|
|
44
|
+
Enter Password ${pass}
|
|
45
|
+
Click Login Button
|
|
46
|
+
|
|
47
|
+
# Avoid: One keyword doing everything
|
|
48
|
+
Login With User And Password And Submit ${user} ${pass}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Resource Organization
|
|
54
|
+
|
|
55
|
+
### Structure by Domain
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
resources/
|
|
59
|
+
├── common.robot # Shared setup, teardown, generic keywords
|
|
60
|
+
├── login_keywords.robot # Login-specific keywords
|
|
61
|
+
├── checkout_keywords.robot
|
|
62
|
+
├── api_keywords.robot
|
|
63
|
+
└── variables.robot # Shared variables (or use variable files)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Layered Imports
|
|
67
|
+
|
|
68
|
+
- **common.robot** — Base libraries, variables, generic keywords
|
|
69
|
+
- **Feature resources** — Import common; add feature-specific keywords
|
|
70
|
+
- **Test files** — Import only needed resources
|
|
71
|
+
|
|
72
|
+
```robot
|
|
73
|
+
*** Settings ***
|
|
74
|
+
# In login.robot
|
|
75
|
+
Resource resources/common.robot
|
|
76
|
+
Resource resources/login_keywords.robot
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Avoid Circular Imports
|
|
80
|
+
|
|
81
|
+
Resource A imports B, B imports A → Error. Keep dependency graph acyclic.
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Variable Scope
|
|
86
|
+
|
|
87
|
+
| Scope | When to Use | How |
|
|
88
|
+
| ----- | ----------- | --- |
|
|
89
|
+
| **Local** | Within keyword | `[Arguments]` or `Set Variable` |
|
|
90
|
+
| **Test** | Single test | `Set Test Variable` |
|
|
91
|
+
| **Suite** | All tests in suite | `Set Suite Variable` |
|
|
92
|
+
| **Global** | Entire run | Variable file, `-v`, or `Set Global Variable` |
|
|
93
|
+
|
|
94
|
+
### Prefer Explicit Passing Over Global State
|
|
95
|
+
|
|
96
|
+
```robot
|
|
97
|
+
# Prefer: Pass as argument
|
|
98
|
+
Login And Verify ${user} ${pass}
|
|
99
|
+
|
|
100
|
+
# Avoid: Rely on global state
|
|
101
|
+
Set Suite Variable ${CURRENT_USER} ${user}
|
|
102
|
+
Login And Verify
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Sensitive Data
|
|
106
|
+
|
|
107
|
+
- Never hardcode passwords, API keys
|
|
108
|
+
- Use variable files loaded per environment
|
|
109
|
+
- Use `-v` or env vars in CI: `-v API_KEY:${API_KEY}`
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Test Independence
|
|
114
|
+
|
|
115
|
+
### Each Test Should Be Runnable Alone
|
|
116
|
+
|
|
117
|
+
- No shared mutable state between tests
|
|
118
|
+
- Each test sets up its own preconditions
|
|
119
|
+
- Use Suite/Test Setup and Teardown for common setup/cleanup
|
|
120
|
+
|
|
121
|
+
### Clean Up in Teardown
|
|
122
|
+
|
|
123
|
+
```robot
|
|
124
|
+
*** Settings ***
|
|
125
|
+
Test Teardown Cleanup Test Data
|
|
126
|
+
|
|
127
|
+
*** Keywords ***
|
|
128
|
+
Cleanup Test Data
|
|
129
|
+
Run Keyword If Test Failed Capture Page Screenshot
|
|
130
|
+
Delete Test User ${TEST_USER}
|
|
131
|
+
Close Browser
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Avoid Test Order Dependencies
|
|
135
|
+
|
|
136
|
+
- Tests should pass in any order
|
|
137
|
+
- Use `--randomize all` occasionally to detect order dependencies
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Locator Strategy
|
|
142
|
+
|
|
143
|
+
### Prefer Stable Locators
|
|
144
|
+
|
|
145
|
+
| Priority | Type | Example | Notes |
|
|
146
|
+
| -------- | ---- | ------- | ----- |
|
|
147
|
+
| 1 | id | `id=submit-btn` | Stable if IDs are consistent |
|
|
148
|
+
| 2 | data-testid | `css=[data-testid=submit]` | Explicit for testing |
|
|
149
|
+
| 3 | name | `name=email` | Good for forms |
|
|
150
|
+
| 4 | role/label | `role=button[name=Submit]` | Accessible |
|
|
151
|
+
| 5 | css/xpath | `css=.btn-primary` | Last resort; can break with UI changes |
|
|
152
|
+
|
|
153
|
+
### Centralize Locators
|
|
154
|
+
|
|
155
|
+
```robot
|
|
156
|
+
*** Variables ***
|
|
157
|
+
${LOGIN_BUTTON} id=login-btn
|
|
158
|
+
${USERNAME_INPUT} id=username
|
|
159
|
+
${PASSWORD_INPUT} id=password
|
|
160
|
+
|
|
161
|
+
*** Keywords ***
|
|
162
|
+
User Clicks Login Button
|
|
163
|
+
Click Element ${LOGIN_BUTTON}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Data-Driven Tests
|
|
169
|
+
|
|
170
|
+
### Use [Template] for Same Flow, Different Data
|
|
171
|
+
|
|
172
|
+
```robot
|
|
173
|
+
*** Test Cases ***
|
|
174
|
+
Login With Multiple Users
|
|
175
|
+
[Template] Login And Verify Success
|
|
176
|
+
user1 pass1
|
|
177
|
+
user2 pass2
|
|
178
|
+
admin admin123
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Use FOR for Iteration
|
|
182
|
+
|
|
183
|
+
```robot
|
|
184
|
+
FOR ${item} IN @{ITEMS}
|
|
185
|
+
Add Item To Cart ${item}
|
|
186
|
+
Verify Cart Contains ${item}
|
|
187
|
+
END
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Error Handling and Resilience
|
|
193
|
+
|
|
194
|
+
### Use TRY/EXCEPT for Expected Failures
|
|
195
|
+
|
|
196
|
+
```robot
|
|
197
|
+
TRY
|
|
198
|
+
Click Element ${OPTIONAL_BUTTON}
|
|
199
|
+
EXCEPT Element not found
|
|
200
|
+
Log Optional button not present, continuing
|
|
201
|
+
END
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Use Wait Until for Flaky Elements
|
|
205
|
+
|
|
206
|
+
```robot
|
|
207
|
+
Wait Until Element Is Visible ${DYNAMIC_ELEMENT} timeout=10s
|
|
208
|
+
Click Element ${DYNAMIC_ELEMENT}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Capture Screenshot on Failure
|
|
212
|
+
|
|
213
|
+
```robot
|
|
214
|
+
Test Teardown Run Keyword If Test Failed Capture Page Screenshot
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## Documentation
|
|
220
|
+
|
|
221
|
+
### Add [Documentation] to Keywords and Tests
|
|
222
|
+
|
|
223
|
+
```robot
|
|
224
|
+
*** Test Cases ***
|
|
225
|
+
User Can Complete Checkout
|
|
226
|
+
[Documentation] Verify full checkout flow with valid payment.
|
|
227
|
+
... Covers: cart review, shipping, payment, confirmation.
|
|
228
|
+
[Tags] smoke checkout
|
|
229
|
+
Given User Has Items In Cart
|
|
230
|
+
When User Completes Checkout With Card ${TEST_CARD}
|
|
231
|
+
Then Order Confirmation Is Displayed
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### Use Tags for Filtering
|
|
235
|
+
|
|
236
|
+
- `smoke` — Critical path
|
|
237
|
+
- `regression` — Full regression
|
|
238
|
+
- `e2e` — End-to-end
|
|
239
|
+
- `api` — API tests
|
|
240
|
+
- `slow` — Long-running (exclude in quick runs)
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Performance
|
|
245
|
+
|
|
246
|
+
- Use **BrowserLibrary** (Playwright) for faster execution than Selenium when possible
|
|
247
|
+
- Run API tests separately from UI tests (faster feedback)
|
|
248
|
+
- Use `--exclude slow` for quick smoke runs
|
|
249
|
+
- Consider `pabot` for parallel execution on large suites
|