~/talk

How to Test Your Compose UI

Talkat droidcon Berlin 2022 · 2022-07-06..07-08· [testing]
slides:none on file

Practical guide to testing Jetpack Compose UIs using the Compose testing library and a small Hydration Tracker sample project: shows using createAndroidComposeRule or createComposeRule, calling setContent, inspecting the semantics tree with onRoot and print, finding nodes via onNodeWithText / tag / contentDescription (and useUnmergedTree), setting Semantics modifier and merge descendants to combine children, performClick and performTextInput behavior, hybrid Compose+View tests via Espresso, and a known Compose 1.2.0‑RC3 bug that swallows clicks on hosted Android views (workaround exists but can be flaky).

AI-written summary · about

  1. 0:00Introduction to Compose UI testing
  2. 2:34Setting up Compose testing
  3. 7:14Understanding the semantics tree
  4. 12:06Modifying semantics with modifiers
  5. 16:25Finding and interacting with nodes
  6. 19:39Performing actions on UI elements
  7. 21:48Testing small UI units
  8. 23:36Testing component behavior
  9. 25:01Hybrid UI testing scenarios
  10. 29:47Testing Android Views in Compose
  11. 31:31Advanced testing topics
  12. 32:13Resources and closing
~/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.