Lesson 9

Test Development Cycle

A structured development process for TDD

PRO

Lesson Outline

Test Development Cycle

In a previous lesson, we discussed that when using Test Driven Development the general process for creating tests looks like this:

  1. Write a test for functionality that you want to build
  2. Check that the test fails
  3. Implement code to satisfy the test
  4. Check that the test passes
  5. Repeat

The process is simple enough, but when you first generate your application and want to start writing your first test you will feel pretty lost. What should you build first? What test do you write first? How do you write a test for something that doesn't exist yet?

The general idea is that we will start with a specific requirement that we want to implement first. Then we will work our way through this process:

  1. Write an E2E test for some specific requirement
  2. Check that the E2E test fails
  3. Based on the failure you get from the E2E test, decide what functionality needs to be worked on in order to get it passing
  4. Write a unit test for the functionality you have decided that you need to create to get the E2E test to pass
  5. Check that the unit test fails
  6. Implement the code to satisfy the unit test
  7. Check if the E2E test passes now
  8. If the E2E test passes, go to Step 1. If the E2E test still fails, go to Step 3.
PRO

Thanks for checking out the preview of this lesson!

You do not have the appropriate membership to view the full lesson. If you would like full access to this module you can view membership options (or log in if you are already have an appropriate membership).