Test Fixing
Debug and fix failing tests systematically with root cause analysis and proper validation.
npx degit LangbaseInc/agent-skills/test-fixing my-test-fixing
Systematically diagnose and fix failing tests through root cause analysis, understanding test intent, and proper validation.
- Failure Analysis - Understand why tests are failing
- Root Cause Detection - Find the actual problem, not just symptoms
- Fix Validation - Ensure fixes address the real issue
- Regression Prevention - Prevent similar failures
- Test Improvement - Enhance test quality while fixing
1. Reproduce Failure
Run the failing test locally and consistently reproduce it
2. Analyze Error
Examine:
- Error messages and stack traces
- Expected vs actual values
- Test setup and teardown
- Dependencies and mocks
3. Identify Root Cause
Determine if failure is due to:
- Code regression
- Test flakiness
- Environment issues
- Outdated test expectations
- Mock/stub problems
4. Develop Fix
Choose appropriate solution:
- Fix the code
- Update the test
- Fix test setup
- Address timing issues
- Update dependencies
5. Validate
Ensure fix:
- Resolves the failure
- Doesn't break other tests
- Addresses root cause
- Improves overall quality
Flaky Tests
- Timing/race conditions
- Random data dependencies
- External service dependencies
- Improper cleanup
Broken Tests
- Code changes broke functionality
- API contract changes
- Dependency updates
- Environment changes
Bad Tests
- Testing implementation, not behavior
- Overly coupled to code structure
- Missing edge cases
- Poor assertions
- Understand test intent before fixing
- Fix root cause, not symptoms
- Run full test suite after fixes
- Update related tests if needed
- Improve test clarity while fixing
- Document non-obvious changes
- Consider test isolation
- Address flakiness permanently
- Test passes consistently
- Other tests still pass
- Root cause addressed
- Test improvements documented
- Edge cases covered
- No new flakiness introduced