<< Home | Work
Reduced AI mocking and improved test reliability
| Area | Work |
| AI used | Claude |
| Source | Reddit comment |
| Posted | 2025-06-02 |
The move
Create a project-specific documentation file that defines your testing philosophy and constraints for the AI to reference.Steps
- Create a file named TESTING.md in your project root.
- Write down your specific testing rules, such as avoiding mocks or using live databases.
- Instruct the AI to read and follow the guidelines in TESTING.md before generating any new tests.
- Review the generated code to ensure it adheres to your defined testing philosophy.
Prompt for your AI
Reference the guidelines in my TESTING.md file to write integration tests for [describe the feature or code block]. Do not mock [specific components] unless absolutely necessary for time or API responses.
What happened
The user struggled with Claude over-mocking code during automated testing. They created a 'TESTING.md' file containing specific instructions to avoid mocking and use live test instances instead. By referencing this file, the AI consistently produced higher quality integration tests without needing manual correction.Watch out
The AI may still occasionally ignore instructions if the context window is too large or the file is poorly structured. Always verify that the generated tests are actually hitting the intended test instances.Give it to your agent
Read https://howtheyuse.ai/p/reduced-ai-mocking-and-improved-test-reliability.md and help me do this.