In this video tutorial on unit and UI testing in iOS, you’ll learn the basics of unit testing by setting up a test target, accessing your app's code and writing your first set of tests.
The easiest thing would be to simply comment out the implementation code. For example,
public func addPancakeHouse(_ pancakeHouse: PancakeHouse) {
// _pancakeHouses.append(pancakeHouse)
}
Likewise for the removePancakeHouse(_:) method.
In test driven development (covered later in this series), you would have wrote this test before the production code. So, this basically simulates this.
Hi Josh,
In the tutorial you use test data stored in a plist. Can you explain why you do this instead of using the existing pancake_houses.plist? Although in this app the model data is stored in the 'pancake_houses.plist`, I imagine this was originally done to simplify the app, whose purpose is to demonstrate how stack views are implemented. In a production app this information would probably be sent over a network. Do you use the test plist to show how to avoid network calls for test data? Should we always do this in our own apps? My understanding is it is best practice to avoid network calls in test data, as this can slow your tests down and we are testing the code, not the network calls.
Thanks
Tim