0
0
iOS Swiftmobile~5 mins

UI testing with XCUITest in iOS Swift - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is XCUITest in iOS development?
XCUITest is a framework by Apple used to write UI tests for iOS apps. It simulates user interactions to check if the app behaves correctly.
Click to reveal answer
beginner
How do you launch the app in an XCUITest case?
You create an XCUIApplication instance and call its launch() method to start the app before testing UI elements.
Click to reveal answer
intermediate
What is the role of XCUIElement in XCUITest?
XCUIElement represents UI elements like buttons, labels, or text fields. You use it to interact with or verify UI components in tests.
Click to reveal answer
intermediate
How can you check if a button exists and is hittable in XCUITest?
Use the exists property to check if the button is present and the isHittable property to check if it can be tapped.
Click to reveal answer
beginner
Why is it important to use accessibility identifiers in UI testing?
Accessibility identifiers uniquely identify UI elements, making tests reliable and less likely to break if the UI layout changes.
Click to reveal answer
Which class do you use to represent the app in XCUITest?
AUIViewController
BXCUIApplication
CXCTestCase
DUIWindow
How do you simulate a tap on a button in XCUITest?
Abutton.press()
Bbutton.select()
Cbutton.click()
Dbutton.tap()
What property would you check to verify if a UI element is visible and interactive?
Aexists
BisEnabled
CisHittable
DisHidden
Why should you assign accessibility identifiers to UI elements?
ATo help UI tests find elements reliably
BTo disable user interaction
CTo change the element's color
DTo improve app performance
Which method starts the app in an XCUITest?
Alaunch()
Brun()
Cstart()
Dopen()
Explain how to write a simple XCUITest that taps a button and verifies a label changes.
Think about the steps a user would do and how to check the result.
You got /6 concepts.
    Describe why accessibility identifiers are crucial for UI testing and how to set them in your app.
    Consider how tests find buttons or labels to tap or check.
    You got /4 concepts.