Post

Something early career software engineers struggle with is the code quality of the tests. The tests ought to be readable and maintainable like your main code; not an unmaintainable copy pasta mess. Invest in tools to make your tests concise.

0 reposts10 likes

Advice I got from an amazing engineer early in my career about tests: 1. Name tests shouldXYZ (e.g. shouldComputeScoreWhen...) - this makes you think about the purpose of the test 2. Structure them with Given/When/Then sections - this makes it clear which parts are setup, tests and assertions

In my experience, well-maintained critical components usually have a 1:1 lines of code to test code ratio in Go —sometimes tests are more. If they’re the majority of your codebase, they deserve to be crafted better.