Edit product

Speed Up Your Django Tests

This book is a practical guide to making your Django project's tests faster. It has many tips and tricks that apply to all projects, big and small. And it covers the two most popular test runners: Django's test framework and pytest.

It's based on my experience speeding up various Django projects' test suites, improving Django's own testing framework, and creating pytest plugins.

Contents

It contains 13 chapters:

1. Introduction - Opening notes, how to use the book.
2. Toolbox - A tour of the various tools you can use to change how your tests run.
3. Measure! - The importance of profiling, with walkthroughs using two different profilers on a test suite.
4. Easy Wins - 11 things you can do in 5 minutes to speed up your test suite.
5. Upgrades - The importance of upgrades, and some how-to guidance to get them done easily.
6. Parallelize - How to use test suite parallelization to boost your tests.
7. Migrations - Reduce the overhead of building your test database.
8. Database Configuration - Tweak your database's configuration to get more speed.
9. CI Configuration - And tweak your CI configuration to boost test speed too.
10. Test Structure - Notes on the best structure for fast, accurate tests, and ways you can restructure.
11. Test Data - The best strategies for creating data in your tests.
12. Targeted Mocking - A guide to mocking, and the best libraries for mocking out specific things such as HTTP requests and time.
13. Outroduction - Closing notes with extra links.

If you'd like a sample of the content, check out these blog posts which contain extracts:

FAQ

Who are you?

Hi, I'm Adam Johnson. I'm an author and solo consultant working with Ansible, AWS, Django, and Python.

I've used Django since 2012 and have been a member of the Django project Technical Board since the 2.2 release cycle.

Is this an official Django product?

The Django Software Foundation didn't help me out with this book, and this is in no way "official." It's a product of A.W.S. (Adam's Web Services) Ltd.

You should make a donation to the DSF separately!

What's included?

A PDF watermarked with your email address, and a resources zip file including images and django projects for all the code examples.

Do you offer any discounts?

I offer 50% discount for those living outside of the Top 50 Countries by GDP per capita*. Please email me with the address on my contact details page to say hi, where you live, and what you’re making with Django, and I’ll send you the discount link.

(*According to the IMF 2019 table of countries’ nominal GDP on this Wikipedia page.)

I don't offer any other discount at current but you can follow my blog to be notified of future seasonal discounts.

Can I get an invoice?

Gumroad will you send you a receipt with a "generate" button to turn it into an invoice, so you can really make your employer pay!

Can I get a refund?

If the book is not what you expected, reply to the download email within 30 days and I'll fully refund you, no questions asked (but feedback welcome).

Praise

“Today I ran into some tests that were taking minutes. I decided to that was reason enough to finally buy your book. An hour later, I've dropped the test time from 3 minutes to 10s. Thanks!”

Tim Schilling on Twitter

“Just finished reading "Speed Up Your Django Tests" by @AdamChainz. It's a good read, found a few nuggets in there. Shame it wasn't available three years ago, but if you're starting your #Django testing adventure today, don't even think twice, grab it”

Tim Kamanin on Twitter

“So nearly through @AdamChainz’s book. I have to say it’s very good.

Much more than just tests in there.

Not for a novice, but good for everyone from levelling-up to advanced. Recommended.”

Carlton Gibson on Twitter

“There are a slew of good tips in there that I'm now planning to bring into my company's test suite. I highly recommend it!”

Matt Layman on Twitter

“I liked this book. People who are new in testing journey or a Django developer working with tests, this is for them. Well organized and you cover a very basic stuff that will help beginners to understand testing well.”

Ngazetungue Muheue on Twitter

”Whenever you find yourself waiting for that test build to finish running - flip a chapter, and you’ll find something to improve. For those who want to go deeper down the rabbit hole, the book is sprinkled generously with references and links.”

Julius Šėporaitis (Technical Reviewer for the book)

“If you already have a basic understanding of Python, Django, and the tests are already running in your Django project, then this Book is for you....

I also sent an email to Adam to ask some questions and got a quick response, which is incredible!“

Michael Yin

“This book contains invaluable insights, and I really like the way you organized it.”

Caio Ariede on Twitter

You've purchased this product

See it in your library

View in Library
Sorry, this item is not available in your location.
Sold out, please go back and pick another option.

0 ratings

  • Watermarked PDF + resources zip file
  • Chapters13
  • Pages195
  • MascotPenelope the Performance Pegasus

Checkout

Speed Up Your Django Tests

Enter your info to complete your purchase of Individual / Up to 3 developers

Card

···· ···· ···· 4242
Test card

05/18

Card

Use a different card?

Card

pp paypal

or pay with

We do not keep any of your sensitive credit card information on file with us unless you ask us to after this purchase is complete.

or pay with

You'll be charged US$49.

Your purchase was successful!

We charged your card and sent you a receipt

    Gumroad Library

    Download from the App Store or text yourself a link to the app

    Thank you for purchasing, may your tests run fast!

    —Adam

    Good news! Since you already have a Gumroad account, it's also been added to your library.

    Powered by Gumroad