10 Ways To Shoot Yourself In The Foot With Tests

This is a series of posts, following a talk I gave (twice - at Pycon-US 2023 and Pycon-IL 2024), about testing best (and not-so-best) practices. The talk shares 10 practices that I had bad experience with, along with ways of avoiding them. The main objective of the post series is to help you write tests that have a better ROI. I’ll discuss different practices, different ways that we can work. These practices affect us by changing the properties of our tests: ...

May 16, 2025 · Shai Geva

Footgun #10 - Wrong Priorities

This mini-post is part of a series about good testing practices, which I also presented at a couple of conferences. Here it is in PyCon US 2023 In this blog post series, we saw a bunch of different practices, and talked about how they will affect us by changing the properties of our tests: Strength - how well they catch bugs Maintainability - how easy it is to work with them Performance - how fast they run The bug funnel is all about performance. Testing a cohesive whole (implementation vs behavior) is about maintainability and strength. ...

May 16, 2025 · Shai Geva

Footgun #9 - Slow Tests

This mini-post is part of a series about good testing practices, which I also presented at a couple of conferences. Here it is in PyCon US 2023 Slow tests are not fun. In this post, I’ll talk about two ways in which they are not fun The bottleneck and the time bomb The feedback loop and the bug funnel The bottleneck and the time bomb The bottleneck here is where the tests take so long to run, that we have a long queue of tasks waiting to be merged to the main branch. (this assumes we’re merging tasks to the main branch one-by-one, and only after the tests pass. Other branching models have similar issues, but this is the simplest to explain) ...

May 16, 2025 · Shai Geva

Footgun #6 - Testing Too Many Things

This mini-post is part of a series about good testing practices, which I also presented at a couple of conferences. Here it is in PyCon US 2023 Just like with product code, if we put too many things in the same place we get a mess. ...

May 16, 2025 · Shai Geva

Footgun #5 - Unclear Language

This mini-post is part of a series about good testing practices, which I also presented at a couple of conferences. Here it is in PyCon US 2023 Another problem that makes it more difficult to understand tests is unclear language. Two guidelines that help me deal with this: ...

October 18, 2024 · Shai Geva

Footgun #4 - No Locality of Behavior

This mini-post is part of a series about good testing practices, which I also presented at a couple of conferences. Here it is in PyCon US 2023 One testing problem that doesn’t get enough attention in my opinion is tests that don’t have locality of behavior. By that I mean cases where a test is broken down into different parts in a way that makes understanding more difficult. This is important in every type of code, and tests are no exception. ...

October 16, 2024 · Shai Geva

Footgun #3 - The Tests Are Not Isolated

This mini-post is part of a series about good testing practices, which I also presented at a couple of conferences. Here it is in PyCon US 2023 Writing tests that are not isolated is a sure way to create unnecessary work for ourselves. By “tests that are not isolated”, I mean tests that sometimes have a different outcome (failing / passing) if we run only a subset of them, if we run them in a different order or if we run them in parallel. ...

October 8, 2024 · Shai Geva

Footgun #2 - Untested Tests

This mini-post is part of a series about good testing practices, which I also presented at a couple of conferences. Here it is in PyCon US 2023 Sometimes our tests lie to us. We have a test that was supposed to protect us from some bug, but that bug happened after all. Of course, what happened was that we made a mistake, and the test didn’t really verify what we thought it does. ...

October 5, 2024 · Shai Geva

Footgun #1 - There Are No Tests

This mini-post is part of a series about good testing practices, which I also presented at a couple of conferences. Here it is in PyCon US 2023 This is a “warm-up footgun” to the blog post series. The easiest way to shoot yourself in the foot, testing-wise, is to have no tests at all. In my experience, writing any tests often helps us - even if these tests are not well-written, and even if they’re just a drop in the sea. ...

October 4, 2024 · Shai Geva