/Tests

Feature Flags Spaghetti // FFs Missing Features

- Eliran Turgeman tl;dr: “I feel like there are some key features missing that would make me switch vendors. I mainly have two problems with current solutions: (1) It can get tedious and messy to turn on/off a feature when multiple FFs were placed for it. (2) Your codebase becomes a FF graveyard if you don’t remember cleaning it, and you probably don’t…” Eli provides suggestions on how to address these. 

featured in #486


The Day I Started Believing In Unit Tests

- Benjamin Richner tl;dr: “The test ran hundreds if not thousands of times successfully. What a waste of time... But then, one day, we started observing test failures. Not many, maybe three over the course of a few weeks. The test actually crashed with a Segmentation Fault, so it was clear that it was a severe error. Interestingly, none of the code under test had actually changed. Well, that's definitely something we had to investigate! I spare you the details of the search for the error, but eventually, I was able to reproduce the problem while a debugger was attached, so the entire context of the problem was handed to me on a silver platter.”

featured in #475


Canon TDD

- Kent Beck tl;dr: Test-driven development (TDD) is a programming method where new features are added without disrupting existing functions. It ensures new and old features work correctly, readies the system for future updates, and builds programmer confidence. The flow is as follows: (1) Write a list of the test scenarios you want to cover. (2) Turn exactly one item on the list into an actual, concrete, runnable test. (3) Change the code to make the test (& all previous tests) pass (adding items to the list as you discover them). (4) Optionally refactor to improve the implementation design. (5) Until the list is empty, go back to #2.

featured in #473


Pytest Daemon: 10X Local Test Iteration Speed

- Ruby Feinstein tl;dr: Discord utilizes a Python monolith to power its API, from sending messages to managing subscriptions. To support this, they use pytest to write and run unit tests. Over the last 8 years, the time it takes to run a single test has continuously grown until it reached a point where it takes 13 seconds to run a single test. even if the test ends up doing absolutely nothing. This post discusses how tests were sped up.

featured in #472


How Much Testing Is Enough?

- George Pirocanac tl;dr: George addresses the complexity of determining adequate testing for software releases. It suggests a multi-faceted approach, emphasizing the importance of documenting the testing process, having a solid base of unit tests, not overlooking integration testing, and performing end-to-end testing for critical user journeys. The article also highlights the need to understand various testing tiers, such as performance, load, fault-tolerance, security, and usability testing. Additionally, it stresses the significance of understanding code and functionality coverage and using field feedback for process improvement.

featured in #467


Else Nuances

- Sam Lee Stan Chan tl;dr: "If your function exits early in an if statement, using or not using an else clause is equivalent in terms of behavior. However, the proper use of else clauses and guard clauses (lack of else) can help emphasize the intent of the code to the reader." The authors discuss this with examples.

featured in #465


Tests Too DRY? Make Them DAMP!

- Derek Snyder Erik Kuefler tl;dr: The authors discuss the balance between the DRY (Don't Repeat Yourself) and DAMP (Descriptive and Meaningful Phrases) principles in unit testing. While DRY promotes code reuse and minimizes duplication, it may not always suit unit tests, as it can make them less readable and harder to manually inspect for correctness. The authors argue for prioritizing DAMP in tests to enhance readability, even if it leads to some code redundancy. They illustrate this with an example where creating users and assertions directly in the test, rather than using helper methods or loops, makes the test clearer. They acknowledge the relevance of DRY in tests for certain aspects but suggest leaning towards DAMP for better clarity and understanding in unit tests.

featured in #464


Tests Are Bad For Developers

- Stephan Schmidt tl;dr: Stephan argues that while tests are crucial for software development, they are perceived negatively by developers because they highlight mistakes without immediate benefits. He suggests that tests become a burden when under business pressure, as they can lead to blame for missed deadlines. Stephan advocates for tests as non-negotiable and part of professional engineering, urging QA to support developers in creating effective tests.

featured in #463


Include Only Relevant Details In Tests

- Dagang Wei tl;dr: "A good test should include only details relevant to the test, while hiding noise:" Dadang shows us an example of this by presenting an embedded function where there is a lot of noise, making it hard to tell which details are relevant to the assert statement and testing function.

featured in #461


10 Things We've Learned About A/B Testing For Startups

- Ian Vanagas tl;dr: “In this week’s issue, we explore the secrets of running truly successful A/B tests (and some pitfalls to avoid).” These include: (1) You need to embrace failure. (2) Good A/B tests have 5 traits. (3) Use the “right place, right time” rule. (4) Create a proposal system. (5) Understanding significance. And more.

featured in #454