GitLab Well Architected
Cookbook navigation
Prompts / Explain Test Failures

Explain Test Failures

TestingDebuggingDeveloperVerifyBeginner

Understand why tests fail, identify root causes, and determine if the code or test needs fixing.

For GitLab Duo

prompt

This test is failing:

Test: [TEST NAME]
Error: [PASTE ERROR MESSAGE]
Test code: [PASTE TEST CODE]

Help me understand:
1. Why is it failing?
2. What's the root cause?
3. How do I fix it?
4. Should I fix the code or the test?

Use the prompt

Include the assertion, actual result, and relevant implementation. The expected behavior helps distinguish a regression from a test that no longer describes what the application should do.