What is TDD #
TDD is a great tool to learn if you want to improve your coding skills. It’s not just about increasing code coverage, but also about changing how your code looks. When you write tests first, you tend to write code that has fewer dependencies and is easier to maintain over time.
How to start #
To start with TDD, you can choose your next task from your job. Try writing a test describing the desired behaviour, then write code to make the test pass. The best would be to start by modifying tests for code that has already been tested, so you don’t need to start from scratch. Just start by thinking about what results you want to achieve and explain this to the computer by changing the existing test. Run the test to ensure it fails and only then move to the actual code.
Examples #
Oh, and by the way, I’ve got GitHub projects where you can check out some examples of TDD in action. Each commit represents a different step in the process, of how I tackled a specific task. There are a lot of details in many commits details! If you’re new to TDD, this is a great way to see how it works in practice. And if you’re already using TDD, you might pick up some new tips and tricks. So head over to the links below and check them out!
FastAPI TDD #
Pandas (Data Science) TDD #
Training/Workshops #
If you’re interested in learning even more about TDD and Python I also offer online and onsite trainings and workshops. I speak both English and Polish, so you can choose the language that’s most comfortable for you.
During the training and workshops, I’ll teach you everything you need to know about TDD and how to use it to improve your Python code. You’ll get hands-on experience with real-world projects and code samples. You’ll learn the best practices for writing testable code and effective tests, but what’s most important on how to think in TDD!
If you’re looking for more personalized help, we can also work based on your projects. Whether you’re struggling with a specific coding challenge or you want to improve the quality and maintainability of your code and tests, I can work with you to achieve those goals.
Resources #
- newses blog post Asserting field from the response
- talk Test Driven Pandas
- talk Be lazy - write tests!
- book Test-Driven Development: By Example