How to Debug a Failing Test with AI (Step-by-Step)

A test is red. The error message is vague. You've stared at the diff for ten minutes and nothing jumps out. This is exactly where AI earns its keep — not by guessing, but by systematically surfacing the class of failure you're dealing with before you've wasted an hour going in the wrong direction. Here's the exact workflow I use, with copy-paste prompts you can drop in today.

Step 1: Collect the Full Failure Context Before You Prompt

AI can only help as much as the context you give it. Before you open a chat window, gather:

The full test output (not just the last line — the whole stack trace or assertion diff)