Red - example 1

Open FirstDemoTests.swift, and add the following code to the FirstDemoTests class:

func test_MakeHeadline_ReturnsStringWithEachWordStartCapital() { 
  let viewController = ViewController() 

  let string = "this is A test headline" 

  let headline = viewController.makeHeadline(from: string) 

This isn't a complete test method yet because we aren't really testing anything. The assertion is missing. But we have to stop writing the test at this point because the compiler complains that Value of type 'ViewController' has no member 'makeHeadline'.

Following the TDD workflow, we need to add code until the compiler stops printing errors. Remember that code does not compile within a test means the test is failing. And a failing test means ...

Get Test-Driven iOS Development with Swift 4 - Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.