Test writing: how many and which, **when using a modern, strongly typed language**?

Posted by dogweather@reddit | ExperiencedDevs | View on Reddit | 42 comments

Lots of conventional wisdom on the subject of "how many tests to write, and what kinds" seems to be old.

The heuristics were formulated in a world with languages that have very basic and somewhat weak static typing (like old Java) or completely dynamic and rather weak (e.g. JS, older Python, Ruby, Perl).

Now, though, truly powerful type systems are making it into the mainstream in langs like Rust, Typescript, Python with type hints, Ruby with Sorbet, and even Haskell has gotten more mainstream.

Personally, I always prefer to get type errors while writing code vs. test failures:

Any strategies to share?