Writing Unit Tests in a Legacy System

Our system is big and complex, it’s not feasible to write automated Unit tests for it.

Often developers shy away from writing unit tests due to their fear of breaking existing

functionality and the perception that it will take a lot of time and effort to actually do it.

However, when we don’t write unit tests the problems tends to increase.

And while most teams will agree that this loop need to be broken, the fear, will stop most of them from even trying.

In this workshop:

  • we will learn how to write unit tests in a legacy system.
  • We will focus on the common issues that make legacy code hard to test.
  • We will understand how these can safely and surely be removed.
  • We will stop fearing changes in our system
  • and we will master those techniques by practicing on real life scenarios.

Lectures: Lior FriedmanUri Goldstein

Intended Audience

  • Tech Leads
  • Developers


  • At least 2 year of experience developing software/test automation


  • Understanding Design for testability
  • Learning to write unit tests on untestable code
  • Learn technique for restructuring legacy code
  • Understanding what makes for improved code


  • Introduction to Design For Testability
  • Pattern for Breaking Dependencies:
    • Sprout class/method
    • Extract Interface
    • Dealing with singletons
    • Dealing with Statics
    • Dealing with Instantiation
  • Power Mocking tools
  • Code/Test Smells


  • Introduction to DFT the problem
  • Dependency breaking patterns
    • Characteristics tests
    • Sprout Class/ Method
    • Dealing with Singletons
    • Dealing with Static method
    • Handling instantiation
  • Leveraging Power Mocking Tools
  • Test/Code Smells


Unless otherwise stated, the workshop runs 1 day, 9:30 to 17:30.

We Can Help, Contact Us Today!