Paste Test Output Directly into Claude to Fix Failing Tests Faster
When a test fails, your first instinct might be to describe the problem. Don't — just paste the test output directly. Claude gets far more from raw assertion errors than from your summary of them.
Here's my failing test output, fix it:
FAIL tests/Feature/OrderTest.php
● it calculates discount for bulk orders
Expected: 85.50
Received: 90.00
at tests/Feature/OrderTest.php:42
Claude reads the expected vs actual values, opens the test file to understand the assertion, then traces back to the source code to find the bug. No back-and-forth needed.
The workflow is simple: run your tests, copy the failure output, paste it into Claude.
# Run the tests yourself first
npm test
# or
php artisan test --compact
# Then paste the full output into Claude
Fix these failing tests: [paste output]
This works even better when you paste the entire test run output, not just the failing test. Claude can see which tests passed and which failed, giving it context about what's working and what broke.
For maximum efficiency, ask Claude to both fix the code and re-run the tests:
Fix the failing tests and run them again to confirm they pass.
Don't stop until all tests are green.
Claude fixes the issue, runs the test suite, and iterates if something is still failing — all without you doing anything between rounds.
Raw test output is the most information-dense bug report you can give Claude — paste it all and let it work.
via Claude Code
Log in to leave a comment.
When a page takes five seconds to load or an API endpoint times out under load, tell Claude which route is slow and it traces the entire code path — controller, services, queries, loops — identifying N+1 queries, redundant computations, missing indexes, and cacheable operations, then fixes each bottleneck.
Flaky tests are maddening — they pass locally, fail in CI, pass again when you retry. Tell Claude to read the test, identify the source of non-determinism — timing issues, shared state, date dependencies, or order-dependent setup — and fix the root cause so the test is reliably green or reliably red.
When your app throws an error, don't just Google the message — paste the full stack trace into Claude Code. It reads the trace, opens the referenced files in your codebase, follows the call chain, and pinpoints the actual root cause instead of just explaining the symptom.