Question - What is TDD?
Answer -
Test-Driven Development (TDD) is a software design practice in which a developer writes tests before code. By inverting the usual order in which software is written, a developer can think of a problem in terms of inputs and outputs and write more testable (and thus more modular) code.
The TDD cycle consists of three steps:
- Red: write a test that fails.
- Green: write the minimal code that passes the test.
- Refactor: improve the code, and make it more abstract, readable, and optimized.