Search⌘ K
AI Features

Test-Driven Development

Explore test-driven development as a key software methodology where tests are written before code to define requirements and guide development. Understand the TDD lifecycle, its benefits like early bug detection and improved code quality, and how it fits within development workflows. Learn to apply TDD effectively alongside other testing practices to enhance the robustness of your machine learning projects.

Overview

When to add new tests? At which stage of the project and development cycle? The standard approach assumes that new tests should be introduced after finding a defect.

Each new production defect highlights the lack of existing tests, so we need to add one to verify that the fault is solved and will not occur again.

Another case is when we may need to add new tests right before we start to refactor our code. Covering our code with tests, we freeze its behavior with all its current use cases and guarantee that everything works before refactoring.

It’s especially applicable when we’re dealing with legacy code. In this case, writing tests makes sure that we understand how current components of the existing codebase work.

Test-driven development

Test-driven development (TDD) is a software development methodology that can be described in two steps:

  1. First, write tests that dictate future APIs, requirements, and use
...