O'Reilly logo

Cocoa Programming for OS X: The Big Nerd Ranch Guide by Aaron Hillegass, Adam Preble, Nate Chandler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a Consistent Testing Environment

Next, you will write tests for ScheduleFetcher. To get started, create a new Swift source file in the RanchForecastTests called ScheduleFetcherTests.swift. In the file, add a new class ScheduleFetcherTests, a subclass of XCTestCase.

i​m​p​o​r​t​ ​F​o​u​n​d​a​t​i​o​ni​m​p​o​r​t​ ​X​C​T​e​s​ti​m​p​o​r​t​ ​R​a​n​c​h​F​o​r​e​c​a​s​tc​l​a​s​s​ ​S​c​h​e​d​u​l​e​F​e​t​c​h​e​r​T​e​s​t​s​:​ ​X​C​T​e​s​t​C​a​s​e​ ​{}

Before you can write any tests against ScheduleFetcher, you need to make sure that the class itself is visible from the RanchForecastTests target. You already imported the RanchForecast target into ScheduleFetcherTests.swift, but you still need to mark the class and its initializer ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required