Unit Test Failure Analyzer

Analyze and fix failing unit tests

6/11/2026
Prompt
Help me understand and fix my failing unit tests.

**Test framework:** {{FRAMEWORK}}
**Language:** {{LANGUAGE}}

**Failing test:**
```{{LANGUAGE}}
{{TEST_CODE}}
```

**Code being tested:**
```{{LANGUAGE}}
{{SOURCE_CODE}}
```

**Test output/failure message:**
```
{{FAILURE_OUTPUT}}
```

**Expected test behavior:** {{EXPECTED}}

Please provide:
1. **Failure Analysis**: Why is the test failing?
2. **Code vs Test Mismatch**: Is the bug in the test or the code?
3. **Assertion Check**: Are the assertions correct?
4. **Test Setup Issues**: Check test setup and teardown
5. **Mock/Stub Problems**: Verify mocks are configured correctly
6. **Fixed Code**: Provide the fix (for test or source code)
7. **Additional Tests**: Suggest additional test cases
8. **Test Design Review**: Improve test design if needed

Or press ⌘C to copy

Variables (6)

Replace these placeholders with your own content before using the prompt.

[{FRAMEWORK][{LANGUAGE][{TEST_CODE][{SOURCE_CODE][{FAILURE_OUTPUT][{EXPECTED]

Ready to use?

Copy and paste into your favorite AI tool

Test this prompt live

Try it in our AI Playground with Claude

Open Playground

Explore more Coding prompts

Browse Coding

Command Palette

Search for a command to run...