Performing unit tests is the traditional way of testing your application and trying to detect failures when a commit is pushed to the server. This way, you can reduce the number of bugs in your application and also ensure that your software is working as expected. Basically, it consists of creating functions that call your object methods and check whether the final result is the one expected.
There also are methodologies based on unit tests, such as test-driven development and behavior-driven development. These methodologies assume that for every development cycle, you have to create the unit tests first.
Xcode comes with a built-in framework called XCTest, which is the one we are going to use in this section. If you prefer using a different framework, feel free to do so; the concepts should be similar. The steps for creating unit tests are as follows:
Open Xcode and create a new project called
Chapter 7 Testing
. Ensure that Swift is the main language and the checkboxes...