...

/

Test-Driven Development Example

Test-Driven Development Example

Learn how to practice a test-driven development workflow.

We'll cover the following...

TDD workflow

Test-driven development (TDD) thrives on a fast feedback loop. As we build a new feature, we repeat a cycle of three steps:

  1. Write a simple test that we know will fail.

  2. Write just enough code to make the test pass.

  3. While the tests are passing, refactor and tidy up our code.

Press + to interact
The three-step TDD cycle
The three-step TDD cycle

The key is that our test should be small. It must test a single example or logic condition. And we should expect ...