Test-Driven Development in Python: Unit Tests, Fixtures, Mocks, Red-Green-Refactor and Building Reliable Code Without Slowing Down

· neobooks
Ebook
77
Pages
Eligible

About this ebook

Tests that arrive after the code break on every refactor, and tests that need a database to check a rounding rule make developers stop running the suite. This book works the other way round. Through one small, fully worked online shop, you practise the red-green-refactor loop in steps that stay small, write unit tests that describe behaviour, and use pytest fixtures and parametrization to remove repetition. You learn when stubs, fakes, spies and mocks fit, how autospec and patching go wrong, and how to design code so that clocks, files, environment variables and logs are easy to control. Later chapters cover keeping the suite fast, adding tests to legacy code, knowing when test-first is not worth it, and building a complete feature from an empty file, with every example run before it was printed.
Tests that arrive after the code break on every refactor, and tests that need a database to check a rounding rule make developers stop running the suite. This book works the other way round. Through one small, fully worked online shop, you practise the red-green-refactor loop in steps that stay s...

Discover more

About the author

Imad Muratspahic is an independent author of practical how-to guides, technical handbooks, history and fiction. The books aim to be clear, honest and useful from the first page.
Imad Muratspahic is an independent author of practical how-to guides, technical handbooks, history and fiction. The books aim to be clear, honest and useful from the first page.

Rate this ebook

Tell us what you think.

Reading information

Smartphones and tablets
Install the Google Play Books app for Android and iPad/iPhone. It syncs automatically with your account and allows you to read online or offline wherever you are.
Laptops and computers
You can listen to audiobooks purchased on Google Play using your computer's web browser.
eReaders and other devices
To read on e-ink devices like Kobo eReaders, you'll need to download a file and transfer it to your device. Follow the detailed Help Center instructions to transfer the files to supported eReaders.