XCUITest Knowledge Check
Nine questions across the course. Pick an answer for each, then check them together. The answers are in the page source, so this is a self-check; the certification exam uses a separate question bank.
1. Your team writes the iOS app in Swift, wants UI tests on every pull request next to the unit tests, and has no Android app. Which tool fits best?
XCUITest lives in the app's project, runs with xcodebuild test next to unit tests and is written in the team's language. Appium is not the only real-device option (XCUITest runs on real devices too), and Selenium does not drive native apps.
2. A new UI test file compiles but none of its tests run with Cmd+U. Its methods are named checkLogin() and checkLogout(). What is wrong?
XCTest discovers tests by name: no-argument methods starting with test. File names do not matter and Xcode boots the simulator itself.
3. app.textFields["login.password"].tap() fails with "No matches found", although print(app.debugDescription) lists an element with identifier login.password. What is the most likely reason?
Queries filter by element type first. A password field is a secure text field, so a textFields query never sees it. The tree printout shows the type at the start of each line.
4. Which assertion gives the most useful failure message when the counter shows the wrong number?
XCTAssertEqual prints both the actual and the expected value. The boolean version only reports that the expression was false, and the other two do not check the number at all.
5. After tapping Save, a toast appears for two seconds and disappears. The test should check that the toast went away before continuing. What do you use?
The predicate wait returns as soon as the toast is gone and fails only if it never goes. A sleep is slow and racy, a one-shot exists check can pass before the toast appeared, and waitForExistence waits for the opposite.
6. In a screen object, signIn(email:password:) returns a TaskListScreen. What does that buy you?
Returning the next screen models navigation in types. It does not change speed, retries or how elements are found.
7. Which pair of settings starts the Tasks app signed in with two tasks and nothing from earlier runs?
The app reads the reset flag from its arguments and the login and seed values from its environment, all at start-up. Values set after launch() only apply to the next launch.
8. The upload to a device cloud is rejected because the tests "cannot be installed". The zip's first entry is Debug-iphonesimulator/. What should you change?
Two mistakes at once: a simulator build, and the parent folder instead of the runner app. Real devices need iphoneos products, and the archive should start with the -Runner.app.
9. A CI run on TestingBot passed, but the certification page does not count it. The command was testingbot xcuitest Tasks.ipa TasksUITests.zip --device "iPhone 16" --real-device --name certificate-xcuitest. What is missing?
For XCUITest runs the build comes from the build capability, which the CLI sets with --build. Without it the run lands in a default "XCUITest Project N" build.
You finished XCUITest Tutorial: iOS UI Testing in Swift
Put what you learned into practice. Run your tests on 6100+ real browsers and physical iOS and Android devices.