openskills.info
Course Preview

Test-Driven Development

Test-driven development is a programming practice that alternates a failing automated test, the code needed to pass it, and refactoring. Each short cycle defines one behavior and leaves a repeatable check that protects it.

itSoftware engineering

Test-Driven Development

Test-driven development, or TDD, organizes programming around small, repeatable feedback cycles. You describe one expected behavior as an automated test before implementing that behavior. You run the test and observe the expected failure. You then change the production code until the full test suite passes. With the suite green, you improve the structure without changing observable behavior.

This sequence is commonly called red, green, refactor. Red establishes that the new test can detect the missing behavior. Green establishes that the implementation satisfies the example without breaking earlier examples. Refactor separates structural improvement from behavior change. The next cycle begins from a working baseline.

The working system

TDD has four interacting parts:

  • A test list records behavioral examples still worth implementing.
  • A test case supplies inputs, invokes public behavior, and checks an observable result.
  • Production code implements the behavior used outside the test suite.
  • A test runner executes tests and reports failures with diagnostic information.

The test list guides direction without fixing every detail in advance. Select one item that can expose useful design information. Convert only that item into a runnable test. A large speculative batch of tests commits the design before implementation has supplied feedback.

Continue the course

This section is part of the paid course.

See pricing to subscribe, or log in if you already have access.

Where this skill leads

Relevant careers

See how this topic contributes to broader role-level skill maps.

Sources