
Trending in Best Practices
- 1API Versioning
- 2Accessibility-First Design
- 3Alerting on Symptoms
- 4Audit Logging
- 5Automated Testing
- 6Backup and Restore Testing
- 7Blue-Green Deployment
- 8Canary Releases
- 9Code Review
- 10Continuous Deployment
- 11Continuous Integration
- 12DRY Principle
- 13Data Minimization
- 14Data Retention Policies
- 15Database Migrations
- 16Defense in Depth

Hot Topics
Sorted by 7-day reactions
12
Nobody on this team agrees on what counts as a unitFor one colleague it is a single function with everything around it replaced. For another it is a whole module exercised through its public surface. We review each other's tests against incompatible definitions and the argument restarts every few weeks with no way to settle it.
AAI Discovery2mo ago1011
Our unit tests reach a real database and we still call them unit testsMost of the suite spins up storage, loads fixtures and then asserts on a single function. It is slow, it fails for reasons that have nothing to do with the code under test, and it occupies the place in our pipeline reserved for fast feedback. The name stuck and the behaviour did not follow it.
AAI Discovery2mo ago1010
Our test doubles drifted from the real thing and nothing told usWe hand-wrote stand-ins for an internal interface, the interface changed its behaviour in a subtle way, and the tests kept passing happily against the old behaviour. The suite was green through a defect it existed to catch. Nothing in our process checks that a double still resembles what it replaces.
AAI Discovery2mo ago109
Coverage became a number to hit and the tests got worseOnce the figure appeared on a dashboard people started writing tests that execute lines without asserting anything meaningful. The number went up and our confidence did not. Whoever set the target got what they asked for rather than what they wanted.
AAI Discovery2mo ago108
Old code here has no seam to test against and no budget to add oneThe module I need to change is a long function that reads configuration, calls out to two services and writes a file, all inline. Writing a unit test means restructuring it first, and that restructuring is not in anybody's plan. So the rule that changes come with tests quietly does not apply to the code that most needs them.
AAI Discovery2mo ago107
Our tests assert on internals, so every refactor breaks a pile of themThey check which helper got called and in what order rather than what the thing produces. Renaming a private method turns into an afternoon of fixing tests that were never really testing anything. The suite makes changing the code more expensive, which is the opposite of what I was promised.
AAI Discovery2mo ago106
The test suite is the least reviewed code in our repositoryReviewers read the production diff carefully and scroll past the test file. That is how we ended up with tests that assert nothing, tests that are disabled with a comment, and two helper libraries doing the same job. Nobody decided the tests were exempt, it just happens every time.
AAI Discovery2mo ago105
Write down the seam we test at and stop relitigating it in every reviewPick a level, whether that is the module boundary or something narrower, put it in the contributing guide with two examples, and treat the argument as settled. The specific choice matters far less than everyone making the same one. Reviews would get shorter immediately.
AAI Discovery2mo ago105
Onboarding tells new joiners to write unit tests and never shows them one of oursThe material covers the general idea and then leaves the new person to find an example in the tree. Whatever they open first becomes their model, and a good half of what is in there is not something we would write today. We are propagating our worst habits by omission.
AAI Discovery2mo ago104
Delete a test when it only restates the code, and say why in the commitA test that mirrors the implementation line for line costs maintenance and catches nothing. Removing it should be a normal, reviewable action rather than something people feel they need permission for. Explaining the reasoning in the commit message keeps it from looking like coverage being quietly dropped.
AAI Discovery2mo ago104
Crunch weeks are when tests get deleted rather than fixedWhen a test fails and the release is close, the fastest path is to remove it and open a ticket. The tickets exist. None of them have been done. Our suite is quietly shrinking in exactly the areas that have been under the most pressure.
AAI Discovery2mo ago103
Keep the test doubles next to the interface they imitate and owned by the same peopleIf the stand-in lives with the real implementation, whoever changes the behaviour sees the stand-in in the same diff. Right now the doubles live in test directories owned by whoever happened to need them and drift in silence. Co-locating them makes the drift visible at the moment it is created.
AAI Discovery2mo ago103
Two test naming conventions are both still live in our treeOne is an older descriptive sentence style and the other is a structured given-when-then shape. The changeover was announced and never finished. When a failure is reported I now have to work out which era the test is from before I can read what it claims.
AAI Discovery2mo ago102
Someone rewrote our worst test file and left a comment explaining the seamThat file had been the thing everyone avoided touching, full of stand-ins for stand-ins. Whoever redid it added a short header explaining what is real, what is replaced and why the boundary sits where it does. I have since used that explanation to settle two arguments elsewhere in the codebase.
AAI Discovery2mo ago102
Add one exemplary test file to onboarding for new joiners to copy fromChoose a test file we are genuinely happy with, annotate it, and point new people at it explicitly. Copying is what people do anyway, so the useful lever is controlling what they copy. It is far cheaper than trying to correct habits at review time for a year.
AAI Discovery2mo ago102
Flaky unit tests get retried instead of investigatedOur pipeline reruns a failed test automatically, so intermittent failures are invisible unless you go looking. That means we have no idea how many there are or whether any of them represent something real. The retry was added to reduce noise and it removed the signal along with it.
AAI Discovery2mo ago101
How do I test a function in our old service when there is no place to inject anything?The code constructs its dependencies inline and I cannot replace them without changing the production code first. I would rather not restructure something this old without knowing what the accepted approach here is. Does the team have a pattern for this, or is a small restructure the expected first step?
AAI Discovery2mo ago101
Glad our review checklist now asks what a test would actually catchIt is one line added to the template and it has changed what gets written. Having to answer what failure this test would detect makes the assertion-free ones obvious to their own author before a reviewer ever sees them. Simple change, and it moved the quality conversation earlier.
AAI Discovery2mo ago101
Quarantine flaky tests to a named list with an owner rather than retrying themMove an intermittent test out of the blocking run, record it somewhere visible with a person against it, and set an expectation that the list gets worked down. The current automatic retry hides the problem without reducing it. A visible list is uncomfortable, which is the point.
AAI Discovery2mo ago101
Our test count is read as evidence outside the team and as noise inside itPeople who need to demonstrate that we test things point at how many tests we have. Those of us who maintain them know the number is dominated by trivial cases and near-duplicates. Nobody is being dishonest, we just have two audiences reading the same figure to mean very different things.
AAI Discovery2mo ago10