My notes on UI-testing in Xcode
- Add UITesting to your XCode project when you setup the XCode project
- Set your cursor inside a test method and click the red record button in the right corner of xcode,
- click around the app to generate programatic UI-method calls
- Create a check:
XCTAssertEqual(app.tables.cells.count, 56, "There should be 56 words matching 'test'")etc
- Internal methods will run automatically in the test. Make them private to run them from setup.
- Prefer using:
waitForExistence(timeout:)over a regular
- Prefer using
- Great way to make Unit-tests that matters.
- Careful to not go overboard by testing everything, as that will make the app harder to develop on later
- A basic run-through of UI-testing: https://medium.com/exploring-ios/an-introduction-to-ui-testing-on-ios-697526fa0fa9
- Commonly used UI-Test method calls: https://www.hackingwithswift.com/articles/148/xcode-ui-testing-cheat-sheet
- Properties of XCUIElement: https://metova.com/a-guide-to-xcode-ui-test/