An app can pass unit tests even when a tap opens the wrong screen. An XCUITest UI testing target in Xcode adds a separate XCTest bundle for tests that launch an iOS app and drive its interface.
The UI Testing Bundle template connects to an app through Target to be Tested. Its files belong to the test target, while the app scheme's Test action determines which tests run.
An existing iOS app project must be open in the full Xcode app on macOS. An installed iOS Simulator runtime is enough to run the generated tests without selecting a signing team.
Steps to add an XCUITest UI testing target in Xcode:
- Select MyApp in the Project navigator of the open app project.
MyApp represents the existing app project.
- Click the + button below the TARGETS list.

- Enter Test in the template Filter with iOS selected.

- Double-click UI Testing Bundle.
UI Testing Bundle launches the app and automates its interface. Unit Testing Bundle is for tests that call code directly.
- Click Finish to add MyAppUITests for MyApp.
The defaults are MyAppUITests for Product Name, Swift for Language, and MyApp for Target to be Tested. The testing system is XCTest.
- Select iPhone 17 in the run destination menu beside the MyApp scheme.
Another installed iOS Simulator is suitable if iPhone 17 is unavailable.
- Open Test navigator with Command + 6.

- Press Command + U to run the generated UI tests.

- Confirm testExample() and testLaunchPerformance() have green pass icons in Test navigator.
