Getting started with Swift Testing
Swift Testing and the older XCTest can be built within the same test target and coexist within the same test bundle. If our project already contains an XCTest bundle, there’s no need to create a new unit-testing bundle to use Swift Testing. We can add new Swift Testing files to the existing target and, over time, convert existing XCTest-based tests to Swift Testing.
There are multiple methods for adding a Swift Testing target to a project. In this section, we will look at how to add a Swift Testing target to both an existing Xcode project and an existing Swift project created with the Swift Package Manager. Let’s start by adding a testing target to an existing Xcode project.
Adding Swift Testing to an existing Xcode project
The following steps outline how to add Swift Testing to an existing Xcode project.
- From the top menu, select File | New | Target…:
 

Figure 18.1: Selecting Target...
...