Pytest: Legacy Code и TDD
Legacy → Testable → TDD: покрываем старый код и добавляем новые фичи правильно.

What you'll learn
Превращаем legacy-код в тестируемый и добавляем новые фичи через TDD. Сквозной проект Todo-приложения: покрываем модуль платежей без тестов, добавляем Premium-подписку через Red-Green-Refactor. Честный разговор о том, когда TDD работает, а когда мешает. 5.5 часов практики от characterization tests до прагматичного TDD.
Working with Legacy: from fear to control
Characterization Tests for unclear code. Seams for test injection. Strangler Fig Pattern for gradual replacement. Practice on payments module without a single test.
TDD without fanaticism: when it works, when it hinders
Red-Green-Refactor in practice: adding Premium subscription to Todo. Honest talk about when to write tests first, when after code. Pragmatic approach.
End-to-end project: not textbook examples
Unified Todo app project throughout course. Cover legacy payments module, add new feature via TDD. Like real work, with all complexities.
Testimonials
alumni“To me, legacy code is simply code without tests. Code without tests is bad code. It doesn't matter how well written it is.”
Michael Feathers (Working Effectively with Legacy Code)
“I'm not a great programmer; I'm just a good programmer with great habits. Test-first programming is one of those habits.”
Kent Beck (создатель TDD)
“Refactoring is a controlled technique for improving the design of an existing code base. Its essence is applying a series of small behavior-preserving transformations.”
Martin Fowler
What's inside
Characterization Tests: test code we don't understand, document behavior through tests
Seams: how to inject tests into untestable code, dependency injection for legacy
Strangler Fig Pattern: gradual legacy code replacement with testable code, migration without big bang
Legacy Practice: cover Todo app payments module without tests
TDD Red-Green-Refactor: cycle in detail, when to write test first, when after
Premium subscription via TDD: add feature to Todo step by step, test → code → refactoring
When TDD works, when it hinders: honest talk, pragmatic approach without fanaticism
Final integration: combine legacy coverage and TDD feature into unified testable project
Prerequisites
Pytest: Professional Tools
requiredLevel 3 course is mandatory. You must know: advanced fixtures, pytest-xdist, src layout, plugins.
Go to courseCourse curriculum
Legacy Code: Characterization Tests
40 минут
Legacy Code: Seams и внедрение тестов
40 минут
Legacy Code: Strangler Fig Pattern
40 минут
Практика: Покрываем модуль платежей
50 минут
TDD: Red-Green-Refactor цикл в деталях
40 минут
TDD Практика: Premium-подписка (Часть 1)
50 минут
TDD Практика: Premium-подписка (Часть 2)
50 минут
TDD: Когда работает, когда мешает
30 минут
FAQ
Do I need to take all previous courses?
Minimum Levels 1-3 are mandatory (basic tests, mocks, professional tools). Level 4 (DB) recommended if working with legacy code using databases.
Is this course about Legacy or TDD?
About both approaches together. First learn to cover legacy code with tests (characterization, seams, strangler fig), then add new features via TDD. Full cycle of working with real project.
I don't have legacy code, is course useful?
Yes! Even if writing new code now, sooner or later you'll face legacy (yours or others'). Plus TDD for new features is universal skill. This course gives both tools.
What should I do after this course?
Apply in your project: choose legacy module, cover with tests. Then add new feature via TDD. After—move to 'Contracts and Production CI/CD' course for full production readiness.
Related Materials
These materials complement the course but are not part of it. Study at your own pace.