notesthoughts

Start testing where the defensive code went

The work history showed stabilization, but less evidence of tests. I want to start with conditions that actually broke and boundaries where failure is costly.

While reviewing my work history, I noticed plenty of defensive code and exception handling, but relatively little evidence left as tests. I had found and blocked conditions that could cause problems without leaving enough ways to check that those conditions would still be handled later.

Trying to improve testing quickly turns into a large question of where to begin. Choosing tools, setting up an environment, and deciding how much of every screen to cover can obscure any immediate starting point.

So the first places I want to revisit are the ones where I already added defensive code: a transformation broken by an empty response, an action enabled in the wrong state, or a screen that failed to recover after an error. These are places where the actual conditions explaining why the code exists are still available.

Can it catch the same failure again?

A test following the current shape of the code is not enough. It needs to fail if the wrong behavior returns. After changing response transformation code, I want to check whether it produces the values the screen needs, rather than whether a particular function was called.

I also want to prioritize by the cost of failure rather than the size of the screen. API response transformation and validation, rules in core flows such as ordering or authentication, and regressions that actually occurred have reasons to come first. Spending the same verification effort on simple wording or style changes deserves reconsideration.

Places where state diverges matter too, such as where user input meets server updates. Checking a single successful screen can miss situations where input must be preserved or recovery is needed after failure.

I cannot yet say this approach is established across all my work. But the next time I fix a bug, I want to leave the conditions that can catch it again beside the fix. I would rather be able to explain that we can detect the same mistake again than merely record that we added more tests.