Automated testing anti-patterns

Sometimes, it’s easier to learn from what not to do rather than what to do. Anti-patterns represent common bad practices, code smells, and pitfalls, in this case, when creating automated tests. You should learn them so that you can spot them.

Luís Soares
CodeX

--

Automated testing is fundamental to software quality. “But this is only a test” is always a flawed argument.

[…] we developers make a mental divide. On one hand we have the application code, and we know that it’s vital to keep it clean and easy to evolve. On the other hand we have the test code, which we know isn’t part of our production environment. The consequence is that the test code often receives considerably less love. This is a dangerous fallacy because from a maintenance perspective there’s really no difference between the two. If our tests lack quality, they will hold us back. Software Design X-Rays

There is no clear structure within the test

Not following an expectable structure in each test makes it hard to maintain it. Tests are living code documentation, so everyone should be able to read/change them quickly.

--

--

Luís Soares
CodeX
Writer for

I write about automated testing, Lean, TDD, CI/CD, trunk-based dev., user-centric dev, domain-centric arch, coding good practices,