28 Jan 2019
What kind of builders do you use in your tests? Do you use the old good builders
where properties are set by a withProperty method? Or maybe, you use builders
that make use of closures? As soon as I joined my team, I found out that there
is another approach to test builders, and it embraces maps. It seemed
innovative, but after a while, it became annoying legacy code. After one of
the debugging sessions, I decided to get rid of it, but the monster fought me
back.
19 Nov 2018
We all know that “there are only two hard things in Computer Science: cache
invalidation and naming things”. However, we know that writing good tests is
hard, too. Does it mean that the author of the famous quote is wrong? Not
necessarily! In fact, what are tests? These are descriptions of some concepts.
They answer the questions: “what?”, “when?” and “how?”. When writing tests, you are
answering these questions by giving names to objects, reasons, and processes. I
think writing tests is hard because it is all about naming. I believe you can
significantly improve your tests just by focusing on giving them correct names. Let
me tell you a story of a pull request I was reviewing some time ago.