Skip to main content

Learn TDD

·433 words·3 mins
Grzegorz Kocjan
Author
Grzegorz Kocjan

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
#

gkocjan/fastapi_tdd

Python
3
2

Pandas (Data Science) TDD
#

gkocjan/pandas_tdd

Python
2
1

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.

Practical TDD in modern Python
·1130 words·6 mins

Resources
#



comments powered by Disqus