@patricio0312rev/skillset 0.1.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/CHANGELOG.md +29 -0
- package/LICENSE +21 -0
- package/README.md +176 -0
- package/bin/cli.js +37 -0
- package/package.json +55 -0
- package/src/commands/init.js +301 -0
- package/src/index.js +168 -0
- package/src/lib/config.js +200 -0
- package/src/lib/generator.js +166 -0
- package/src/utils/display.js +95 -0
- package/src/utils/readme.js +196 -0
- package/src/utils/tool-specific.js +233 -0
- package/templates/ai-engineering/agent-orchestration-planner/ SKILL.md +266 -0
- package/templates/ai-engineering/cost-latency-optimizer/ SKILL.md +270 -0
- package/templates/ai-engineering/doc-to-vector-dataset-generator/ SKILL.md +239 -0
- package/templates/ai-engineering/evaluation-harness/ SKILL.md +219 -0
- package/templates/ai-engineering/guardrails-safety-filter-builder/ SKILL.md +226 -0
- package/templates/ai-engineering/llm-debugger/ SKILL.md +283 -0
- package/templates/ai-engineering/prompt-regression-tester/ SKILL.md +216 -0
- package/templates/ai-engineering/prompt-template-builder/ SKILL.md +393 -0
- package/templates/ai-engineering/rag-pipeline-builder/ SKILL.md +244 -0
- package/templates/ai-engineering/tool-function-schema-designer/ SKILL.md +219 -0
- package/templates/architecture/adr-writer/ SKILL.md +250 -0
- package/templates/architecture/api-versioning-deprecation-planner/ SKILL.md +331 -0
- package/templates/architecture/domain-model-boundaries-mapper/ SKILL.md +300 -0
- package/templates/architecture/migration-planner/ SKILL.md +376 -0
- package/templates/architecture/performance-budget-setter/ SKILL.md +318 -0
- package/templates/architecture/reliability-strategy-builder/ SKILL.md +286 -0
- package/templates/architecture/rfc-generator/ SKILL.md +362 -0
- package/templates/architecture/scalability-playbook/ SKILL.md +279 -0
- package/templates/architecture/system-design-generator/ SKILL.md +339 -0
- package/templates/architecture/tech-debt-prioritizer/ SKILL.md +329 -0
- package/templates/backend/api-contract-normalizer/ SKILL.md +487 -0
- package/templates/backend/api-endpoint-generator/ SKILL.md +415 -0
- package/templates/backend/auth-module-builder/ SKILL.md +99 -0
- package/templates/backend/background-jobs-designer/ SKILL.md +166 -0
- package/templates/backend/caching-strategist/ SKILL.md +190 -0
- package/templates/backend/error-handling-standardizer/ SKILL.md +174 -0
- package/templates/backend/rate-limiting-abuse-protection/ SKILL.md +147 -0
- package/templates/backend/rbac-permissions-builder/ SKILL.md +158 -0
- package/templates/backend/service-layer-extractor/ SKILL.md +269 -0
- package/templates/backend/webhook-receiver-hardener/ SKILL.md +211 -0
- package/templates/ci-cd/artifact-sbom-publisher/ SKILL.md +236 -0
- package/templates/ci-cd/caching-strategy-optimizer/ SKILL.md +195 -0
- package/templates/ci-cd/deployment-checklist-generator/ SKILL.md +381 -0
- package/templates/ci-cd/github-actions-pipeline-creator/ SKILL.md +348 -0
- package/templates/ci-cd/monorepo-ci-optimizer/ SKILL.md +298 -0
- package/templates/ci-cd/preview-environments-builder/ SKILL.md +187 -0
- package/templates/ci-cd/quality-gates-enforcer/ SKILL.md +342 -0
- package/templates/ci-cd/release-automation-builder/ SKILL.md +281 -0
- package/templates/ci-cd/rollback-workflow-builder/ SKILL.md +372 -0
- package/templates/ci-cd/secrets-env-manager/ SKILL.md +242 -0
- package/templates/db-management/backup-restore-runbook-generator/ SKILL.md +505 -0
- package/templates/db-management/data-integrity-auditor/ SKILL.md +505 -0
- package/templates/db-management/data-retention-archiving-planner/ SKILL.md +430 -0
- package/templates/db-management/data-seeding-fixtures-builder/ SKILL.md +375 -0
- package/templates/db-management/db-performance-watchlist/ SKILL.md +425 -0
- package/templates/db-management/etl-sync-job-builder/ SKILL.md +457 -0
- package/templates/db-management/multi-tenant-safety-checker/ SKILL.md +398 -0
- package/templates/db-management/prisma-migration-assistant/ SKILL.md +379 -0
- package/templates/db-management/schema-consistency-checker/ SKILL.md +440 -0
- package/templates/db-management/sql-query-optimizer/ SKILL.md +324 -0
- package/templates/foundation/changelog-writer/ SKILL.md +431 -0
- package/templates/foundation/code-formatter-installer/ SKILL.md +320 -0
- package/templates/foundation/codebase-summarizer/ SKILL.md +360 -0
- package/templates/foundation/dependency-doctor/ SKILL.md +163 -0
- package/templates/foundation/dev-environment-bootstrapper/ SKILL.md +259 -0
- package/templates/foundation/dev-onboarding-builder/ SKILL.md +556 -0
- package/templates/foundation/docs-starter-kit/ SKILL.md +574 -0
- package/templates/foundation/explaining-code/SKILL.md +13 -0
- package/templates/foundation/git-hygiene-enforcer/ SKILL.md +455 -0
- package/templates/foundation/project-scaffolder/ SKILL.md +65 -0
- package/templates/foundation/project-scaffolder/references/templates.md +126 -0
- package/templates/foundation/repo-structure-linter/ SKILL.md +0 -0
- package/templates/foundation/repo-structure-linter/references/conventions.md +98 -0
- package/templates/frontend/animation-micro-interaction-pack/ SKILL.md +41 -0
- package/templates/frontend/component-scaffold-generator/ SKILL.md +562 -0
- package/templates/frontend/design-to-component-translator/ SKILL.md +547 -0
- package/templates/frontend/form-wizard-builder/ SKILL.md +553 -0
- package/templates/frontend/frontend-refactor-planner/ SKILL.md +37 -0
- package/templates/frontend/i18n-frontend-implementer/ SKILL.md +44 -0
- package/templates/frontend/modal-drawer-system/ SKILL.md +377 -0
- package/templates/frontend/page-layout-builder/ SKILL.md +630 -0
- package/templates/frontend/state-ux-flow-builder/ SKILL.md +23 -0
- package/templates/frontend/table-builder/ SKILL.md +350 -0
- package/templates/performance/alerting-dashboard-builder/ SKILL.md +162 -0
- package/templates/performance/backend-latency-profiler-helper/ SKILL.md +108 -0
- package/templates/performance/caching-cdn-strategy-planner/ SKILL.md +150 -0
- package/templates/performance/capacity-planning-helper/ SKILL.md +242 -0
- package/templates/performance/core-web-vitals-tuner/ SKILL.md +126 -0
- package/templates/performance/incident-runbook-generator/ SKILL.md +162 -0
- package/templates/performance/load-test-scenario-builder/ SKILL.md +256 -0
- package/templates/performance/observability-setup/ SKILL.md +232 -0
- package/templates/performance/postmortem-writer/ SKILL.md +203 -0
- package/templates/performance/structured-logging-standardizer/ SKILL.md +122 -0
- package/templates/security/auth-security-reviewer/ SKILL.md +428 -0
- package/templates/security/dependency-vulnerability-triage/ SKILL.md +495 -0
- package/templates/security/input-validation-sanitization-auditor/ SKILL.md +76 -0
- package/templates/security/pii-redaction-logging-policy-builder/ SKILL.md +65 -0
- package/templates/security/rbac-policy-tester/ SKILL.md +80 -0
- package/templates/security/secrets-scanner/ SKILL.md +462 -0
- package/templates/security/secure-headers-csp-builder/ SKILL.md +404 -0
- package/templates/security/security-incident-playbook-generator/ SKILL.md +76 -0
- package/templates/security/security-pr-checklist-skill/ SKILL.md +62 -0
- package/templates/security/threat-model-generator/ SKILL.md +394 -0
- package/templates/testing/contract-testing-builder/ SKILL.md +492 -0
- package/templates/testing/coverage-strategist/ SKILL.md +436 -0
- package/templates/testing/e2e-test-builder/ SKILL.md +382 -0
- package/templates/testing/flaky-test-detective/ SKILL.md +416 -0
- package/templates/testing/integration-test-builder/ SKILL.md +525 -0
- package/templates/testing/mocking-assistant/ SKILL.md +383 -0
- package/templates/testing/snapshot-test-refactorer/ SKILL.md +375 -0
- package/templates/testing/test-data-factory-builder/ SKILL.md +449 -0
- package/templates/testing/test-reporting-triage-skill/ SKILL.md +469 -0
- package/templates/testing/unit-test-generator/ SKILL.md +548 -0
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-reporting-triage-skill
|
|
3
|
+
description: Automatically categorizes test failures, suggests responsible owners, and provides common fix checklists. Generates actionable test reports with failure analysis. Use for "test reporting", "failure triage", "test analysis", or "test automation".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Test Reporting & Triage Skill
|
|
7
|
+
|
|
8
|
+
Automatically triage test failures and suggest next actions.
|
|
9
|
+
|
|
10
|
+
## Failure Categorization
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
// types/test-failure.ts
|
|
14
|
+
export type FailureCategory =
|
|
15
|
+
| "timeout"
|
|
16
|
+
| "assertion"
|
|
17
|
+
| "network"
|
|
18
|
+
| "database"
|
|
19
|
+
| "authentication"
|
|
20
|
+
| "permission"
|
|
21
|
+
| "configuration"
|
|
22
|
+
| "flaky"
|
|
23
|
+
| "infrastructure"
|
|
24
|
+
| "unknown";
|
|
25
|
+
|
|
26
|
+
export interface TestFailure {
|
|
27
|
+
testName: string;
|
|
28
|
+
category: FailureCategory;
|
|
29
|
+
errorMessage: string;
|
|
30
|
+
stackTrace: string;
|
|
31
|
+
suggestedOwner: string;
|
|
32
|
+
suggestedFixes: string[];
|
|
33
|
+
runId: string;
|
|
34
|
+
timestamp: Date;
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Failure Analyzer
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
// analyzers/failure-analyzer.ts
|
|
42
|
+
export class FailureAnalyzer {
|
|
43
|
+
categorize(error: Error, testName: string): TestFailure {
|
|
44
|
+
const errorMessage = error.message.toLowerCase();
|
|
45
|
+
const stackTrace = error.stack || "";
|
|
46
|
+
|
|
47
|
+
// Timeout detection
|
|
48
|
+
if (errorMessage.includes("timeout") || errorMessage.includes("exceeded")) {
|
|
49
|
+
return {
|
|
50
|
+
testName,
|
|
51
|
+
category: "timeout",
|
|
52
|
+
errorMessage: error.message,
|
|
53
|
+
stackTrace,
|
|
54
|
+
suggestedOwner: "Performance Team",
|
|
55
|
+
suggestedFixes: [
|
|
56
|
+
"Check if API is slow",
|
|
57
|
+
"Increase timeout value",
|
|
58
|
+
"Optimize database query",
|
|
59
|
+
"Check for network issues",
|
|
60
|
+
],
|
|
61
|
+
runId: process.env.CI_RUN_ID || "local",
|
|
62
|
+
timestamp: new Date(),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Network errors
|
|
67
|
+
if (
|
|
68
|
+
errorMessage.includes("econnrefused") ||
|
|
69
|
+
errorMessage.includes("network") ||
|
|
70
|
+
errorMessage.includes("fetch failed")
|
|
71
|
+
) {
|
|
72
|
+
return {
|
|
73
|
+
testName,
|
|
74
|
+
category: "network",
|
|
75
|
+
errorMessage: error.message,
|
|
76
|
+
stackTrace,
|
|
77
|
+
suggestedOwner: "DevOps Team",
|
|
78
|
+
suggestedFixes: [
|
|
79
|
+
"Check if service is running",
|
|
80
|
+
"Verify network connectivity",
|
|
81
|
+
"Check firewall rules",
|
|
82
|
+
"Verify DNS resolution",
|
|
83
|
+
],
|
|
84
|
+
runId: process.env.CI_RUN_ID || "local",
|
|
85
|
+
timestamp: new Date(),
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Database errors
|
|
90
|
+
if (
|
|
91
|
+
errorMessage.includes("database") ||
|
|
92
|
+
errorMessage.includes("prisma") ||
|
|
93
|
+
errorMessage.includes("unique constraint")
|
|
94
|
+
) {
|
|
95
|
+
return {
|
|
96
|
+
testName,
|
|
97
|
+
category: "database",
|
|
98
|
+
errorMessage: error.message,
|
|
99
|
+
stackTrace,
|
|
100
|
+
suggestedOwner: "Backend Team",
|
|
101
|
+
suggestedFixes: [
|
|
102
|
+
"Check database connection",
|
|
103
|
+
"Verify test data cleanup",
|
|
104
|
+
"Check for race conditions",
|
|
105
|
+
"Review migration status",
|
|
106
|
+
],
|
|
107
|
+
runId: process.env.CI_RUN_ID || "local",
|
|
108
|
+
timestamp: new Date(),
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Authentication errors
|
|
113
|
+
if (
|
|
114
|
+
errorMessage.includes("unauthorized") ||
|
|
115
|
+
errorMessage.includes("authentication") ||
|
|
116
|
+
errorMessage.includes("401")
|
|
117
|
+
) {
|
|
118
|
+
return {
|
|
119
|
+
testName,
|
|
120
|
+
category: "authentication",
|
|
121
|
+
errorMessage: error.message,
|
|
122
|
+
stackTrace,
|
|
123
|
+
suggestedOwner: "Auth Team",
|
|
124
|
+
suggestedFixes: [
|
|
125
|
+
"Check auth token validity",
|
|
126
|
+
"Verify test user credentials",
|
|
127
|
+
"Check session expiration",
|
|
128
|
+
"Review auth middleware",
|
|
129
|
+
],
|
|
130
|
+
runId: process.env.CI_RUN_ID || "local",
|
|
131
|
+
timestamp: new Date(),
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Assertion failures
|
|
136
|
+
if (
|
|
137
|
+
errorMessage.includes("expected") &&
|
|
138
|
+
errorMessage.includes("received")
|
|
139
|
+
) {
|
|
140
|
+
return {
|
|
141
|
+
testName,
|
|
142
|
+
category: "assertion",
|
|
143
|
+
errorMessage: error.message,
|
|
144
|
+
stackTrace,
|
|
145
|
+
suggestedOwner: this.determineOwnerFromPath(stackTrace),
|
|
146
|
+
suggestedFixes: [
|
|
147
|
+
"Review recent code changes",
|
|
148
|
+
"Check if test expectations are correct",
|
|
149
|
+
"Verify test data setup",
|
|
150
|
+
"Check for breaking changes",
|
|
151
|
+
],
|
|
152
|
+
runId: process.env.CI_RUN_ID || "local",
|
|
153
|
+
timestamp: new Date(),
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Default: unknown
|
|
158
|
+
return {
|
|
159
|
+
testName,
|
|
160
|
+
category: "unknown",
|
|
161
|
+
errorMessage: error.message,
|
|
162
|
+
stackTrace,
|
|
163
|
+
suggestedOwner: "On-Call Engineer",
|
|
164
|
+
suggestedFixes: [
|
|
165
|
+
"Review error message and stack trace",
|
|
166
|
+
"Check recent commits",
|
|
167
|
+
"Run test locally to reproduce",
|
|
168
|
+
"Add more specific error handling",
|
|
169
|
+
],
|
|
170
|
+
runId: process.env.CI_RUN_ID || "local",
|
|
171
|
+
timestamp: new Date(),
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
private determineOwnerFromPath(stackTrace: string): string {
|
|
176
|
+
if (stackTrace.includes("/frontend/")) return "Frontend Team";
|
|
177
|
+
if (stackTrace.includes("/backend/")) return "Backend Team";
|
|
178
|
+
if (stackTrace.includes("/api/")) return "API Team";
|
|
179
|
+
if (stackTrace.includes("/database/")) return "Database Team";
|
|
180
|
+
return "Development Team";
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Test Report Generator
|
|
186
|
+
|
|
187
|
+
```typescript
|
|
188
|
+
// reporters/test-report.ts
|
|
189
|
+
import { FailureAnalyzer } from "../analyzers/failure-analyzer";
|
|
190
|
+
|
|
191
|
+
export class TestReporter {
|
|
192
|
+
private analyzer = new FailureAnalyzer();
|
|
193
|
+
private failures: TestFailure[] = [];
|
|
194
|
+
|
|
195
|
+
recordFailure(error: Error, testName: string) {
|
|
196
|
+
const failure = this.analyzer.categorize(error, testName);
|
|
197
|
+
this.failures.push(failure);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
generateReport(): string {
|
|
201
|
+
const grouped = this.groupByCategory();
|
|
202
|
+
const report: string[] = [];
|
|
203
|
+
|
|
204
|
+
report.push("# Test Failure Report\n");
|
|
205
|
+
report.push(`Generated: ${new Date().toISOString()}\n`);
|
|
206
|
+
report.push(`Total Failures: ${this.failures.length}\n\n`);
|
|
207
|
+
|
|
208
|
+
// Summary by category
|
|
209
|
+
report.push("## Summary by Category\n");
|
|
210
|
+
Object.entries(grouped).forEach(([category, failures]) => {
|
|
211
|
+
report.push(`- ${category}: ${failures.length} failures`);
|
|
212
|
+
});
|
|
213
|
+
report.push("\n");
|
|
214
|
+
|
|
215
|
+
// Detailed failures
|
|
216
|
+
report.push("## Detailed Failures\n\n");
|
|
217
|
+
Object.entries(grouped).forEach(([category, failures]) => {
|
|
218
|
+
report.push(`### ${category.toUpperCase()} (${failures.length})\n\n`);
|
|
219
|
+
|
|
220
|
+
failures.forEach((failure, i) => {
|
|
221
|
+
report.push(`#### ${i + 1}. ${failure.testName}\n`);
|
|
222
|
+
report.push(`**Owner:** ${failure.suggestedOwner}\n\n`);
|
|
223
|
+
report.push(`**Error:**\n\`\`\`\n${failure.errorMessage}\n\`\`\`\n\n`);
|
|
224
|
+
report.push(`**Suggested Fixes:**\n`);
|
|
225
|
+
failure.suggestedFixes.forEach((fix) => {
|
|
226
|
+
report.push(`- ${fix}\n`);
|
|
227
|
+
});
|
|
228
|
+
report.push("\n");
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
return report.join("");
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
generateSlackMessage(): string {
|
|
236
|
+
const grouped = this.groupByCategory();
|
|
237
|
+
const messages: string[] = [];
|
|
238
|
+
|
|
239
|
+
messages.push("🔴 *Test Failures Detected*\n");
|
|
240
|
+
messages.push(`Total: ${this.failures.length} failures\n`);
|
|
241
|
+
|
|
242
|
+
Object.entries(grouped).forEach(([category, failures]) => {
|
|
243
|
+
const icon = this.getCategoryIcon(category);
|
|
244
|
+
messages.push(`${icon} ${category}: ${failures.length}`);
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
// Top 3 failures
|
|
248
|
+
messages.push("\n*Top Failures:*");
|
|
249
|
+
this.failures.slice(0, 3).forEach((failure, i) => {
|
|
250
|
+
messages.push(`\n${i + 1}. \`${failure.testName}\``);
|
|
251
|
+
messages.push(` Owner: @${failure.suggestedOwner}`);
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
return messages.join("\n");
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
private groupByCategory(): Record<string, TestFailure[]> {
|
|
258
|
+
return this.failures.reduce((acc, failure) => {
|
|
259
|
+
if (!acc[failure.category]) {
|
|
260
|
+
acc[failure.category] = [];
|
|
261
|
+
}
|
|
262
|
+
acc[failure.category].push(failure);
|
|
263
|
+
return acc;
|
|
264
|
+
}, {} as Record<string, TestFailure[]>);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
private getCategoryIcon(category: string): string {
|
|
268
|
+
const icons: Record<string, string> = {
|
|
269
|
+
timeout: "⏱️",
|
|
270
|
+
network: "🌐",
|
|
271
|
+
database: "💾",
|
|
272
|
+
authentication: "🔐",
|
|
273
|
+
assertion: "❌",
|
|
274
|
+
flaky: "🔄",
|
|
275
|
+
infrastructure: "🏗️",
|
|
276
|
+
unknown: "❓",
|
|
277
|
+
};
|
|
278
|
+
return icons[category] || "❓";
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
## Common Fix Checklists
|
|
284
|
+
|
|
285
|
+
```typescript
|
|
286
|
+
// checklists/fix-checklists.ts
|
|
287
|
+
export const fixChecklists = {
|
|
288
|
+
timeout: {
|
|
289
|
+
title: "Timeout Failure Checklist",
|
|
290
|
+
steps: [
|
|
291
|
+
"☐ Check if the timeout is too short",
|
|
292
|
+
"☐ Verify API response time in logs",
|
|
293
|
+
"☐ Check database query performance",
|
|
294
|
+
"☐ Look for network latency issues",
|
|
295
|
+
"☐ Verify no infinite loops or deadlocks",
|
|
296
|
+
"☐ Check if external services are slow",
|
|
297
|
+
"☐ Consider increasing timeout temporarily",
|
|
298
|
+
"☐ Optimize slow code path if confirmed slow",
|
|
299
|
+
],
|
|
300
|
+
},
|
|
301
|
+
|
|
302
|
+
flaky: {
|
|
303
|
+
title: "Flaky Test Checklist",
|
|
304
|
+
steps: [
|
|
305
|
+
"☐ Run test 10 times locally",
|
|
306
|
+
"☐ Check for race conditions",
|
|
307
|
+
"☐ Verify proper test cleanup",
|
|
308
|
+
"☐ Look for timing dependencies",
|
|
309
|
+
"☐ Check for shared state between tests",
|
|
310
|
+
"☐ Verify no randomness in test data",
|
|
311
|
+
"☐ Check for network/external dependencies",
|
|
312
|
+
"☐ Add explicit waits where needed",
|
|
313
|
+
],
|
|
314
|
+
},
|
|
315
|
+
|
|
316
|
+
database: {
|
|
317
|
+
title: "Database Error Checklist",
|
|
318
|
+
steps: [
|
|
319
|
+
"☐ Verify database is running",
|
|
320
|
+
"☐ Check connection string",
|
|
321
|
+
"☐ Verify test database cleanup",
|
|
322
|
+
"☐ Check for constraint violations",
|
|
323
|
+
"☐ Look for migration issues",
|
|
324
|
+
"☐ Verify proper transaction handling",
|
|
325
|
+
"☐ Check for concurrent access issues",
|
|
326
|
+
"☐ Review recent schema changes",
|
|
327
|
+
],
|
|
328
|
+
},
|
|
329
|
+
|
|
330
|
+
assertion: {
|
|
331
|
+
title: "Assertion Failure Checklist",
|
|
332
|
+
steps: [
|
|
333
|
+
"☐ Review what changed in recent commits",
|
|
334
|
+
"☐ Verify test expectations are still valid",
|
|
335
|
+
"☐ Check if feature requirements changed",
|
|
336
|
+
"☐ Run test locally to reproduce",
|
|
337
|
+
"☐ Check test data setup",
|
|
338
|
+
"☐ Verify mocks are up to date",
|
|
339
|
+
"☐ Review API contract changes",
|
|
340
|
+
"☐ Update test if behavior change is intentional",
|
|
341
|
+
],
|
|
342
|
+
},
|
|
343
|
+
};
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
## CI Integration
|
|
347
|
+
|
|
348
|
+
```yaml
|
|
349
|
+
# .github/workflows/test-report.yml
|
|
350
|
+
name: Test Report
|
|
351
|
+
|
|
352
|
+
on:
|
|
353
|
+
workflow_run:
|
|
354
|
+
workflows: ["CI"]
|
|
355
|
+
types: [completed]
|
|
356
|
+
|
|
357
|
+
jobs:
|
|
358
|
+
report:
|
|
359
|
+
runs-on: ubuntu-latest
|
|
360
|
+
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
|
|
361
|
+
|
|
362
|
+
steps:
|
|
363
|
+
- uses: actions/checkout@v4
|
|
364
|
+
|
|
365
|
+
- name: Download test results
|
|
366
|
+
uses: actions/download-artifact@v4
|
|
367
|
+
with:
|
|
368
|
+
name: test-results
|
|
369
|
+
|
|
370
|
+
- name: Generate report
|
|
371
|
+
run: npm run analyze-failures
|
|
372
|
+
|
|
373
|
+
- name: Post to Slack
|
|
374
|
+
uses: slackapi/slack-github-action@v1
|
|
375
|
+
with:
|
|
376
|
+
channel-id: "test-failures"
|
|
377
|
+
payload: ${{ steps.analyze.outputs.slack_message }}
|
|
378
|
+
env:
|
|
379
|
+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
380
|
+
|
|
381
|
+
- name: Create GitHub Issue
|
|
382
|
+
uses: actions/github-script@v7
|
|
383
|
+
with:
|
|
384
|
+
script: |
|
|
385
|
+
const report = require('./test-report.json');
|
|
386
|
+
github.rest.issues.create({
|
|
387
|
+
owner: context.repo.owner,
|
|
388
|
+
repo: context.repo.repo,
|
|
389
|
+
title: `Test Failures - ${new Date().toISOString()}`,
|
|
390
|
+
body: report.markdown,
|
|
391
|
+
labels: ['test-failure', 'automated'],
|
|
392
|
+
});
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
## Dashboard Metrics
|
|
396
|
+
|
|
397
|
+
```typescript
|
|
398
|
+
// dashboard/test-metrics.ts
|
|
399
|
+
export interface TestMetrics {
|
|
400
|
+
totalTests: number;
|
|
401
|
+
passed: number;
|
|
402
|
+
failed: number;
|
|
403
|
+
skipped: number;
|
|
404
|
+
duration: number;
|
|
405
|
+
failureRate: number;
|
|
406
|
+
|
|
407
|
+
failuresByCategory: Record<FailureCategory, number>;
|
|
408
|
+
failuresByOwner: Record<string, number>;
|
|
409
|
+
flakyTests: string[];
|
|
410
|
+
slowTests: Array<{ name: string; duration: number }>;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
export function generateMetrics(results: TestResult[]): TestMetrics {
|
|
414
|
+
const failures = results.filter((r) => r.status === "failed");
|
|
415
|
+
const analyzer = new FailureAnalyzer();
|
|
416
|
+
|
|
417
|
+
const categorized = failures.map((f) =>
|
|
418
|
+
analyzer.categorize(f.error, f.testName)
|
|
419
|
+
);
|
|
420
|
+
|
|
421
|
+
return {
|
|
422
|
+
totalTests: results.length,
|
|
423
|
+
passed: results.filter((r) => r.status === "passed").length,
|
|
424
|
+
failed: failures.length,
|
|
425
|
+
skipped: results.filter((r) => r.status === "skipped").length,
|
|
426
|
+
duration: results.reduce((sum, r) => sum + r.duration, 0),
|
|
427
|
+
failureRate: (failures.length / results.length) * 100,
|
|
428
|
+
|
|
429
|
+
failuresByCategory: categorized.reduce((acc, f) => {
|
|
430
|
+
acc[f.category] = (acc[f.category] || 0) + 1;
|
|
431
|
+
return acc;
|
|
432
|
+
}, {} as Record<FailureCategory, number>),
|
|
433
|
+
|
|
434
|
+
failuresByOwner: categorized.reduce((acc, f) => {
|
|
435
|
+
acc[f.suggestedOwner] = (acc[f.suggestedOwner] || 0) + 1;
|
|
436
|
+
return acc;
|
|
437
|
+
}, {} as Record<string, number>),
|
|
438
|
+
|
|
439
|
+
flakyTests: identifyFlakyTests(results),
|
|
440
|
+
slowTests: results
|
|
441
|
+
.filter((r) => r.duration > 5000)
|
|
442
|
+
.sort((a, b) => b.duration - a.duration)
|
|
443
|
+
.slice(0, 10),
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
## Best Practices
|
|
449
|
+
|
|
450
|
+
1. **Auto-categorize**: Classify failures automatically
|
|
451
|
+
2. **Suggest owners**: Route to right team
|
|
452
|
+
3. **Actionable fixes**: Provide clear next steps
|
|
453
|
+
4. **Track trends**: Monitor failure patterns
|
|
454
|
+
5. **Notify quickly**: Slack/email on failures
|
|
455
|
+
6. **Create issues**: Auto-file for persistent failures
|
|
456
|
+
7. **Dashboard**: Visual metrics for team
|
|
457
|
+
|
|
458
|
+
## Output Checklist
|
|
459
|
+
|
|
460
|
+
- [ ] Failure categorization logic
|
|
461
|
+
- [ ] Owner assignment rules
|
|
462
|
+
- [ ] Fix checklists per category
|
|
463
|
+
- [ ] Report generation (Markdown/Slack)
|
|
464
|
+
- [ ] CI integration
|
|
465
|
+
- [ ] GitHub issue creation
|
|
466
|
+
- [ ] Slack notifications
|
|
467
|
+
- [ ] Dashboard metrics
|
|
468
|
+
- [ ] Trend analysis
|
|
469
|
+
- [ ] Flaky test detection
|