TDD Cycle
Learn the cycle of test-driven development with the help of a simple example.
We'll cover the following...
TDD cycle
TDD is a three-part cycle:
- Write a test that fails.
- Get the test to pass.
- 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 happens when the profile is empty
...