From the course: JavaScript: Test-Driven Development (ES6)

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

The basic TDD cycle

The basic TDD cycle - JavaScript Tutorial

From the course: JavaScript: Test-Driven Development (ES6)

Start my 1-month free trial

The basic TDD cycle

- [Instructor] The TDD process, as practiced by most programmers, follows a very simple series of steps that are repeated over and over again as we write our code. And these steps are one: we write a failing test; two: we write production code but only enough to make the failing test pass; and three: we refactor the code we wrote. And that's all there is to it. We keep going through each of these steps for each piece of functionality we want to implement. Let's go through each of these steps in a little more detail. The first step is to write a failing test. This is often one of the things that takes the longest for people to get used to when adopting TDD. We're not allowed to write any production code until you have a failing test. The reason for this is that it forces us to define the specific functionality we want to implement, instead of just jumping right into writing production code. So for example, if we have…

Contents