Debug Test Case
debug_testcaseAnalyze failing or flaky tests to get execution history, failure patterns, common error messages, and AI-assisted root-cause suggestions for debugging.
Instructions
AI-assisted root cause analysis for a failing or flaky test. Returns historical execution data, aggregated failure patterns (error types, frequency, browsers affected), common error messages, and a debugging_prompt field (the TestDino debugging checklist, the same for every test). If you are debugging a failing test, call get_debug_evidence first: it already carries the debugging rules, the verdict and the artifact links. Come here afterwards only for the stored AI suggestions or the full execution history. Read debugging_prompt before drawing conclusions: it says how to read the history and when a cause is proven. Any fixes you produce from this analysis are recommendations only — validate them against the live code before applying. Use this when the user asks "why is test X failing?", "debug test X", or "is test X flaky?". Identify the test by testcase_id (its pw_test_id, exact) or testcase_name (its title). A title can match several tests (the same test under several Playwright projects, or the same title in several files): pair it with playwright_project and/or suite_file_path. If the response is 409 AMBIGUOUS_IDENTITY, its candidates name the Playwright project of each — call again with playwright_project set to the one you mean, or testcase_id set to its pw_test_id. Set include_ai_insights=true to also get TestDino's stored AI analysis under ai_fixes (recommendations and quick fixes, often with code), for the most recent failing execution or the testrun_id you pass. AI payloads are generated lazily: while an ai_fixes section reports "in_progress", poll get_ai_insights(testrun_id=..., testcase_id=...) until it reports "completed". An "unavailable" section carries the upstream statusCode: retry a 5xx or timeout once via get_ai_insights; a 4xx (bad ids) is final.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"projectId": "<projectId>"
},
"name": "debug_testcase"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | Project ID | |
| testrun_id | No | Only with include_ai_insights: fetch the AI analysis for this specific run instead of the most recent failure. | |
| testcase_id | No | The test's pw_test_id — exact, never ambiguous. Wins over testcase_name and suite_file_path. | |
| testcase_name | No | Test case name / title to debug. Required unless testcase_id is given. | |
| suite_file_path | No | Optional spec file path — disambiguates when several tests share the same title in different files. A path with leading folders or only the file name also matches. Example: "tests/checkout.spec.ts". | |
| playwright_project | No | Optional Playwright project name (from playwright.config, e.g. "chromium") — picks one test when the same title runs under several projects. Ignored with testcase_id. | |
| include_ai_insights | No | Attach AI recommendations + quick fixes for this test under `ai_fixes` (targets the most recent failing execution unless testrun_id is set). |