analyze_test_failure
Analyze failed tests with forensic details including logs, screenshots, error classification, and comparison with last passed execution to identify root causes.
Instructions
๐ Deep forensic analysis of failed test including logs, screenshots, error classification, and similar failures. ๐ก NEW: Compare with last passed execution to see what changed! ๐ก TIP: Can be auto-invoked from Zebrunner test URLs like: https://workspace.zebrunner.com/projects/PROJECT/automation-launches/LAUNCH_ID/tests/TEST_ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| testId | Yes | Test ID (e.g., 5451420) | |
| testRunId | Yes | Test Run ID / Launch ID (e.g., 120806) | |
| projectKey | No | Project key (e.g., 'MCP') - alternative to projectId | |
| projectId | No | Project ID - alternative to projectKey | |
| includeScreenshots | No | Include screenshot links | |
| includeLogs | No | Include log analysis | |
| includeArtifacts | No | Include all test artifacts | |
| includePageSource | No | Include page source analysis | |
| includeVideo | No | Include video URL | |
| analyzeSimilarFailures | No | Find similar failures in the launch | |
| analyzeScreenshotsWithAI | No | Download and analyze screenshots with AI (Claude Vision) | |
| screenshotAnalysisType | No | Screenshot analysis type: basic (metadata+OCR) or detailed (includes Claude Vision) | detailed |
| format | No | Output format: detailed, summary, or jira (ready for Jira ticket creation) | detailed |
| compareWithLastPassed | No | Compare current failure with last passed execution to identify what changed |
Implementation Reference
- src/server-with-reporting.ts:175-192 (registration)MCP tool registration for 'analyze_test_failure', including tool name, description, Zod input schema inline, and handler that calls reportingHandlers.analyzeTestFailureById(args). Note: schema imported from ./types/api.js but defined inline in registration.server.tool( "analyze_test_failure", "๐ Deep forensic analysis of a failed test including logs, screenshots, error classification, and similar failures", { testId: z.number().int().positive().describe("Test ID (e.g., 5451420)"), testRunId: z.number().int().positive().describe("Test Run ID / Launch ID (e.g., 120806)"), projectKey: z.string().min(1).optional().describe("Project key (e.g., 'MCP') - alternative to projectId"), projectId: z.number().int().positive().optional().describe("Project ID - alternative to projectKey"), includeScreenshots: z.boolean().default(true).describe("Include screenshot analysis"), includeLogs: z.boolean().default(true).describe("Include log analysis"), includeArtifacts: z.boolean().default(true).describe("Include all test artifacts"), includePageSource: z.boolean().default(true).describe("Include page source analysis"), includeVideo: z.boolean().default(false).describe("Include video URL"), analyzeSimilarFailures: z.boolean().default(true).describe("Find similar failures in the launch"), format: z.enum(['detailed', 'summary']).default('detailed').describe("Output format: detailed or summary") }, async (args) => reportingHandlers.analyzeTestFailureById(args) );
- src/types/api.ts:128-140 (schema)Zod input schema definition AnalyzeTestFailureInputSchema used for validating tool parameters like testId, testRunId, analysis options (screenshots, logs, video, similar failures). Imported and used in server registration.export const AnalyzeTestFailureInputSchema = z.object({ testId: z.number().int().positive(), testRunId: z.number().int().positive(), // launchId projectKey: z.string().min(1).optional(), projectId: z.number().int().positive().optional(), includeScreenshots: z.boolean().default(true), includeLogs: z.boolean().default(true), includeArtifacts: z.boolean().default(true), includePageSource: z.boolean().default(true), includeVideo: z.boolean().default(false), analyzeSimilarFailures: z.boolean().default(true), format: z.enum(['detailed', 'summary']).default('detailed') });
- src/server-with-reporting.ts:191-192 (handler)Handler function for the tool - delegates execution to ZebrunnerReportingToolHandlers instance's analyzeTestFailureById method.async (args) => reportingHandlers.analyzeTestFailureById(args) );
- src/server-with-reporting.ts:65-65 (helper)Instantiation of ZebrunnerReportingToolHandlers with reportingClient, providing the analyzeTestFailureById method (definition not found in codebase).const reportingHandlers = new ZebrunnerReportingToolHandlers(reportingClient);
- src/server-with-reporting.ts:61-61 (helper)ZebrunnerReportingClient instantiation used by reporting handlers for API calls to fetch test data, logs, screenshots needed for failure analysis.const reportingClient = new ZebrunnerReportingClient(reportingConfig);