In software design, a pattern is a reusable solution to solve recurring problems. There are a bunch of them, including for example singleton, factory, builder, facade, proxy, decorator, or adapter, to name a few. Anti-patterns are also patterns, but undesirable ones. Concerning to testing, it is worth to know some of these anti-patterns to avoid them in our tests:
- Second class citizens: Test code containing a lot of duplicated code, making it hard to maintain.
- The free ride (also known as Piggyback): Instead of writing a new method to verify another feature/requirement, a new assertion is added to an existing test.
- Happy path: It only verifies expected results without testing for boundaries and exceptions.
- The local hero: A test dependent to some specific local environment. This anti-pattern can be summarized in the phrase It works in my machine.
- The hidden...