...

/

TDD Cycle

TDD Cycle

Learn the cycle of test-driven development with the help of a simple example.

TDD cycle

TDD is a three-part cycle:

  1. Write a test that fails.
  2. Get the test to pass.
  3. Clean up any code added or changed in the prior two steps.

Our first step is to write a test that defines the behavior we want to build into the system. In general, we seek to write the test that represents the smallest possible useful increment to the code that already exists.

Rebuilding the Profile class

For our exercise, we will rebuild the Profile class. Let’s think about the simplest cases that can occur and write a test that demonstrates what ...

Access this course and 1400+ top-rated courses and projects.