Exploring the Swift Testing basics
We will start our journey by adding the Swift Testing framework to an existing project.
Select File | New | Target from the Xcode’s menu to do that. Then, in the template chooser, locate Unit Testing Bundle and select it (Figure 14.1):
Figure 14.1: The new target template chooser
Figure 14.1 shows the template chooser window in Xcode. When performing a search for testing, Unit Testing Bundle is easy to locate. Note that we also have a UI Testing Bundle template. However, UI testing isn’t supported yet in Swift Testing, so we’ll focus now on unit testing.
How can we perform UI testing?
UI testing, also known as end-to-end testing, is a different topic in app testing. It is also what we call “black-box” testing, meaning that the test function doesn’t know the internal code, only the user interface components. The basic way to conduct a UI test is to use XCTest, Apple’...