Testing logic with XCTest
This section is going to help you to discover the testing capabilities on iOS with XCTest
. Even if you haven't written any tests before, you might have thoughts or ideas about it. To start testing code, you don't need to have a computer science degree or spend days studying the absolute best way to test your code. In fact, the chances are that you're already testing your code and you don't even know it.
So, what does it mean to test your code? That's what this section aims to make clear. First, you will read about the different types of tests you can write. Then, you'll learn what XCTest
is and how you can set up a test suite for an app. Finally, you'll learn how to optimally test some actual code and how code can be refactored to make it more testable.
Understanding what it means to test code
When you test your code, you're essentially making sure that certain input produces the desired output. A very basic...