112: Six Principles of Readable Tests - David Seddon
"Code is read much more often than it is written." - Guido van Rossum
This is true for both production code and test code.
This is true for both production code and test code.
When you are trying to understand why a test is failing, you'll be very grateful to the test author if they've taken the care to make it readable.
David Seddon came up with 6 principles to help us write more readable tests.
We discuss these, as well as more benefits of readable tests.
We discuss these, as well as more benefits of readable tests.
David's 6 Principles of Readable Tests:
- Profit from the work of others
- Put naming to work
- Show only what matters
- Don’t repeat yourself
- Arrange, act, assert
- Aim high
Special Guest: David Seddon.
Links:
- How to write readable tests (presentation) · David Seddon
- How to write readable tests (slides)
- pytest
- WebTest
- factory_boy
- django-webtest
Help support the show AND learn pytest:
- The Complete pytest course is now a bundle, with each part available separately.
- pytest Primary Power teaches the super powers of pytest that you need to learn to use pytest effectively.
- Using pytest with Projects has lots of "when you need it" sections like debugging failed tests, mocking, testing strategy, and CI
- Then pytest Booster Rockets can help with advanced parametrization and building plugins.
- Whether you need to get started with pytest today, or want to power up your pytest skills, PythonTest has a course for you.
Creators and Guests
