
154: Don't Mock your Database - Jeff Triplett
05/21/21 β’ 30 min
You need tests for your web app. And it has a database. What do you do with the database during testing? Should you use the real thing? or mock it? Jeff Triplett says don't mock it.
In this episode, we talk with Jeff about testing web applications, specifically Django apps, and of course talk about the downsides of database mocking.
Links:
- "π€ In ~12 years, I have never seen a case where mocking a database was a good idea. ..."
- Django News
- Moto
- Test & Code 103: Django - Lacey Williams Henschel
- Model Bakery: Smart fixtures for better tests
- Faker
Sponsored by:
- 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.
You need tests for your web app. And it has a database. What do you do with the database during testing? Should you use the real thing? or mock it? Jeff Triplett says don't mock it.
In this episode, we talk with Jeff about testing web applications, specifically Django apps, and of course talk about the downsides of database mocking.
Links:
- "π€ In ~12 years, I have never seen a case where mocking a database was a good idea. ..."
- Django News
- Moto
- Test & Code 103: Django - Lacey Williams Henschel
- Model Bakery: Smart fixtures for better tests
- Faker
Sponsored by:
- 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.
Previous Episode

153: Playwright for Python: end to end testing of web apps - Ryan Howard
Playwright is an end to end automated testing framework for web apps with Python support and even a pytest plugin.
Links:
Sponsored by:
- 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.
Next Episode

155: Four Questions to Ask Frequently During Software Projects - Tim Ottinger
Tim Ottinger has four questions that work great in many situations, from doing homework, to cooking, to writing code, to entire software projects.
They are actually awesome questions to ask during a software project.
We discuss the questions, where they came from, and look at some uses in software.
The questions:
- What is it that needs to be done?
- What do we need in order to do it?
- Where can we get what we need?
- How can we tell if weβre doing it right?
Bonus question that can be swapped out for #1:
- What's the most important thing that it doesn't do yet?
Links:
Sponsored by:
- 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.
If you like this episode youβll love
Episode Comments
Generate a badge
Get a badge for your website that links back to this episode
<a href="https://goodpods.com/podcasts/test-and-code-41514/154-dont-mock-your-database-jeff-triplett-14066895"> <img src="https://storage.googleapis.com/goodpods-images-bucket/badges/generic-badge-1.svg" alt="listen to 154: don't mock your database - jeff triplett on goodpods" style="width: 225px" /> </a>
Copy