# Why I Write Tests but Still Ship Bugs

Why testing doesn't eliminate bugs — understanding what testing can and cannot do.

By OpenBlog · 2026-11-19T21:19:39.479Z

## Introduction

I write tests for my code. I have pytest suites for my Python projects, Jest suites for my JavaScript projects, and I run them before every deploy. And yet, I still ship bugs. Not constantly, but often enough that I've had to confront an uncomfortable truth: testing doesn't eliminate bugs. It just changes which bugs you ship.

This isn't an argument against testing. I still write tests, and I still think you should too. But it's an argument for understanding what testing can and cannot do, and for building systems that assume bugs will happen anyway.

## What Testing Does Well

The first thing testing does well is catch regressions. I change a function to fix one bug, run my test suite, and discover that I broke something else that used to work. Without the test, I would have shipped both bugs. With the test, I catch the regression before it reaches users. This is valuable, and it's probably the main reason I write tests.

The second thing testing does is document behavior. A test shows exactly what a function is supposed to do with specific inputs. It's documentation that can't lie — if the test passes, the behavior is correct. When a new developer joins the project, they can read the tests to understand what the code is supposed to do.

## What Testing Doesn't Do

But here's what testing doesn't do well: it doesn't catch bugs in your understanding of the problem. If you misunderstand what the user needs, your tests will pass because they test your misunderstanding. If you misunderstand how an API works, your tests will pass because they test your misunderstanding. If you forget to handle a case you didn't know existed, your tests will pass because they don't test that case.

I've shipped bugs where my tests were perfect but my assumptions were wrong. I built a feature that worked exactly as I designed it, but the design didn't match what users actually needed. I optimized a database query that was already fast enough, while ignoring a different query that was slow in production. I handled error cases I could predict, but missed the one I couldn't.

## The Expensive Bugs

The bugs that testing misses are often the most expensive ones. A regression bug is annoying but usually easy to fix once you find it. A design bug — building the wrong thing — can waste months of work. An assumptions bug — building the right thing for the wrong context — can be invisible until users encounter it in the wild.

## What I Do Instead

So what do I do instead? I test, but I also:

*   **Ship small changes.** The smaller the change, the smaller the potential blast radius if something is wrong.
*   **Watch production closely.** I monitor error rates, response times, and user reports after every deploy.
*   **Have rollback plans.** If something goes wrong, I can revert quickly.
*   **Talk to users.** I ask them what's confusing, what's broken, what they expected.
*   **Accept that bugs happen.** I don't pretend my code is perfect. I build systems that can survive imperfection.

## Conclusion

Testing is a tool, not a guarantee. Use it, value it, but don't let it give you false confidence. The best defense against bugs isn't perfect testing — it's the ability to detect, respond to, and recover from them quickly.

## Comprehensive Deep Dive: Complete Guide

This comprehensive section covers everything you need to know to master this topic. Whether you're just starting or looking to deepen your expertise, this guide provides actionable, practical knowledge you can apply immediately.

### Part 1: Understanding the Fundamentals

Every technical topic has fundamentals that everything else builds upon. Without a solid grasp of the basics, advanced topics will always feel confusing. Here are the core concepts you must understand:

*   **Core principles:** The underlying ideas that govern how this works
*   **Key terminology:** The vocabulary you need to communicate effectively
*   **Common patterns:** Recurring solutions to common problems
*   **Anti-patterns:** Approaches that seem right but cause problems
*   **Best practices:** Proven approaches that work in most situations

### Part 2: Hands-On Practice

Theory without practice is useless. Here's how to get hands-on experience:

1.  **Set up your environment.** Install the tools you need and verify they work.
2.  **Follow a tutorial.** Work through a step-by-step guide from start to finish.
3.  **Modify the example.** Change one thing at a time and observe what happens.
4.  **Build from scratch.** Create your own project without following a tutorial.
5.  **Break it and fix it.** Intentionally introduce errors and learn how to debug them.

### Part 3: Advanced Topics

Once you're comfortable with the basics, explore these advanced areas:

*   Performance optimization techniques
*   Security hardening approaches
*   Scaling strategies for growing workloads
*   Monitoring and observability
*   Disaster recovery and backup strategies

### Part 4: Real-World Application

How to apply what you've learned in real situations:

*   Start with a small, well-defined problem
*   Break the problem into smaller, manageable pieces
*   Implement one piece at a time, testing as you go
*   Review your work and look for improvements
*   Document what you learned for future reference

### Common Mistakes to Avoid

Every learner makes mistakes. Here are the most common ones and how to avoid them:

*   **Trying to learn everything at once.** Focus on one thing at a time.
*   **Not practicing regularly.** Consistency beats intensity.
*   **Avoiding difficult topics.** The hard parts are where the most learning happens.
*   **Not asking for help.** Everyone gets stuck. Reach out to communities.
*   **Comparing your beginning to someone else's middle.** Everyone's journey is different.

### Measuring Progress

How to know you're improving:

*   You can explain concepts clearly to others
*   You can build things without constantly referring to documentation
*   You can debug problems efficiently
*   You can make informed decisions about trade-offs
*   You can teach others what you've learned

### Conclusion

Mastering any technical skill is a journey, not a destination. There will always be more to learn, new tools to explore, and deeper levels of understanding to reach. The key is to start, stay consistent, and enjoy the process of learning and building.

Remember: every expert was once a beginner who didn't give up.

## Final Resources

*   Official documentation — your primary reference
*   Community forums — Stack Overflow, GitHub Discussions, Reddit
*   Video courses — for structured learning paths
*   Technical books — deep dives into specific topics
*   Conference recordings — cutting-edge ideas and techniques
*   Open source projects — read real code from experienced developers

## Your Next Steps

1.  Pick one specific thing from this guide to try today
2.  Set aside 30 minutes of focused practice time
3.  Build something small that interests you
4.  Share what you learn with others
5.  Repeat tomorrow

## Extended Guide: Practical Examples

In this section, we walk through concrete, practical examples you can follow step by step. Each example builds on the previous one, moving from simple to more advanced scenarios.

### Example 1: Getting Started

Start here if you're new to this topic. This example covers the absolute basics:

1.  Read the documentation for the tool or technology you're using.
2.  Install everything you need and verify the installation works.
3.  Create a minimal working example — just enough to confirm it runs.
4.  Run the example and observe the output.
5.  Make one small change and run it again to see what happens.

### Example 2: Building on the Basics

Once you have a working example, expand it:

*   Add error handling for common failure cases.
*   Include input validation to prevent bad data.
*   Add logging so you can see what's happening.
*   Write tests for the core functionality.
*   Document what each part does.

### Example 3: Production-Ready

Move toward something you could actually deploy:

*   Configure for different environments (development, staging, production).
*   Add security measures like authentication and rate limiting.
*   Set up monitoring and alerting.
*   Implement backup and recovery procedures.
*   Write runbooks for common operational tasks.

## Troubleshooting Common Problems

Here are the most common issues you'll encounter and how to fix them:

| Problem | Likely Cause | Solution |
| --- | --- | --- |
| Connection refused | Service not running or wrong port | Check service status and firewall rules |
| Permission denied | Incorrect file permissions or user | Check ownership and permissions |
| Module not found | Missing dependency | Install required packages |
| Timeout | Network issue or slow query | Check connectivity and optimize queries |
| Authentication failed | Wrong credentials or expired token | Verify login details and token validity |

## Tools and Resources

*   Official documentation — always your primary source
*   Community forums — Stack Overflow, GitHub Discussions
*   Video tutorials — for visual learners
*   Books — for comprehensive coverage
*   Open source projects — read real-world code
*   Newsletters — stay updated on new developments

## Learning Path

Here's a suggested order for learning this topic:

1.  Day 1: Read the introduction and set up your environment
2.  Day 2-3: Work through basic examples
3.  Day 4-5: Build a small project from scratch
4.  Week 2: Add features and handle edge cases
5.  Week 3: Deploy and monitor your project
6.  Month 2+: Contribute to open source or build something bigger

## Conclusion

Mastering any technical topic takes time, practice, and patience. Don't expect to understand everything immediately. Focus on one concept at a time, build small things, and gradually work toward more complex projects.

The best way to learn is by doing. Start today, even if it's just for 30 minutes.

## Your Action Plan

1.  Identify one specific thing you want to accomplish
2.  Find the relevant documentation and examples
3.  Set aside dedicated time for practice
4.  Build something, break it, fix it, and learn
5.  Share what you've learned with others

## Final Thoughts

This topic rewards patience and consistent practice. Don't rush through the basics — they're the foundation everything else builds on. Take your time, build small things, and gradually increase complexity.

The most important thing is to start. You don't need perfect conditions, expensive tools, or prior experience. You just need to begin.

Good luck on your learning journey.

## References

• [pytest](https://docs.pytest.org/)

• [Jest](https://jestjs.io/)

• [Testing JavaScript](https://testingjavascript.com/)

• [Martin Fowler](https://martinfowler.com/)

Canonical URL: https://blog.naborajs.me/articles/writing-tests-still-ship-bugs-4103