~/talk

Swift Techniques for Testing

Talkat dotSwift 2020 · on Monday, 2020-02-03· [testing, swift]

Two concrete techniques: using enums per screen to map raw string labels to XCUIElementQuery calls and to return XCUIElement instances (removing repeated hard‑coded strings), and a boolean function builder that collects booleans into an array and runs XCTAssertTrue/XCTAssertFalse on each. Examples use SwiftUI currency app: switching base currency, checking table vs label state, and verifying initial text field value. Code extracts element‑type queries into an ElementType enum, simplifying tests and reducing brittle string duplication.

AI-written summary · about

  1. 0:00Intro
  2. 0:49Features
  3. 1:19UI Testing with XCTestCase
  4. 1:38UI Testing with XC TestCase
  5. 2:02Testing initial state
  6. 3:22Extending our enum
  7. 3:43Rewriting initial state test
  8. 4:32Without using the enum
  9. 4:45Testing functionality using enum
  10. 6:18Adding to the enum
  11. 7:02Revisiting the functionality test
  12. 7:57Creating an ElementType enum
  13. 8:51Get XCUIElement from ElementType
  14. 9:20Using ElementType
  15. 10:06Recap
  16. 11:27BooleanFunctionBuilder
  17. 12:10Using assert True
  18. 12:48Resources
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.