You are here

Real-Life Test Maintenance - Anti-Patterns, Refactoring and Reviews

Note: There are prerequisites for attending this workshop. Please see the prerequisites section.

Automated tests are code too, and as such, we're obliged to not only make them functionally correct, we need to maintain them. In TDD we're told that refactoring the code is an important step in the process. Refactoring tests is also part of the job.

In this session, we'll go over anti-patterns in automated tests. We'll talk about code smells in tests - things that probably shouldn't keep the way they are. Smells like duplication, inaccurate naming, inaccurate asserts, leaky tests and more. But mostly, we'll refactor them to make them more readable, accurate and understandable for other humans. After all, they are going to stay with us for a long time. Finally, we'll look at how to do proper test review. How to use the time we have, when and how to do it, what to fix as we're reviewing, and let's not forget the human aspect - be nice to each other.

Since we're investing so much in automated tests, we need to make sure that our teammates, not to mention our future selves, can continue using tests with ease. If "Test maintenance" is bringing you down, it's time to get your hands dirty.

Key takeaways:

  • Identify anti-patterns and smells in tests
  • Refactoring patterns to make the tests succinct, readable and maintainable
  • How to do a test review



A computer with the following software installed:

  • IDE: Eclipse or Intellij IDEA
  • Java: 1.8

Workshop exercises can be found from here.