From the course: iOS App Development: Test-Driven Development

Unlock the full course today

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

Development techniques

Development techniques

From the course: iOS App Development: Test-Driven Development

Start my 1-month free trial

Development techniques

- We now have a basic understanding of the theory behind test-driven development. Let's move on to the main technique we'll be using for the rest of the course. Red, green, refactor. Burn this into your mind's eye. It's going to be your best friend on every single one of your future test-driven development projects. This technique is essentially a closed development loop, continually repeating itself until the test suite is done and your project is shipped. Let's break down the components individually. First, we write the minimum amount of code we need to create a failing test. This is the red phase. Second, we write the actual implementation code to make the failing test pass. Now if your test passes, we're in the green phase. Last, the refactor phase, where we look at any repeated or extraneous code in our test functions, and either move it into the test setup or delete it entirely. Keep the dry principle in mind here, don't repeat yourself. Keep in mind that refactoring may extend…

Contents