Before we start writing automated tests, let's cover the Red, Green, Refactor workflow. We've actually been applying some of the principles of this workflow already. However, we need automated testing in place to really apply it.
Let's take a look at how it works. We've already been applying most of these steps. However, the steps in bold are new.
There are two new steps in the list above. In step 3, we need to confirm that the test fails before we write the code to get it passing. We haven't covered this yet. It's a little more involved than it sounds — there are "good" fails and "bad" fails. We'll cover both soon.
We covered step 6 briefly in Introduction to Programming. However, running all previous tests manually is time-consuming so it wasn't part of our workflow. With automated testing, we'll be able to run all of our tests with a single terminal command. If any of our tests don't work (whether it's our most recent test or an older one), we need to isolate the issue and fix it before moving on.
It should be clear why this is called the Red, Green, Refactor workflow:
In the next lesson, we'll learn how to set up Jest. Then we'll be ready to apply the Red, Green, Refactor workflow and start writing tests.