In his book Working Effectively with Legacy Code, Michael Feathers defines legacy code as:

“Legacy code is code without tests”

What I like about this sentence is that illustrates the importance of tests in Software Development.

There are different ways to look at tests: in most cases, tests act as a safety net, supporting engineers to catch unwanted changes in the code. But tests can be much more than this, and can be used as a framework to write better software as well, helping engineers to design better APIs, or even used as documentation, supporting newcomers to understand the expected behavior and design decisions.

When writing tests, engineers might take different strategies. Some prefer to write them after the implementation is finish, while others prefer to write tests before, for instance in Test-Driven Development (TDD), or Behavior-Driven Development (BDD). But the truth is, these different approaches don’t diminish the importance of having a good test coverage and testable code.

  1. The Different Types of Tests
  2. Test Doubles
    1. Dummies
    2. Mocks
    3. Stubs
    4. Partials
    5. Fakes
  3. Fixtures
  4. Frameworks and Tools
Did you like what you just read? Say thanks with a cup of coffee ☕️