4

I use the new Jetpack Compose, now comes time to test UI. Does anyone know the tools for testing it?
Since Espresso mainly relies on view I don't think that it can help.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Nurseyit Tursunkulov
  • 8,012
  • 12
  • 44
  • 78

2 Answers2

6

Android has a code sample (Jetnews) that includes a couple of UI tests. This may help you to set up some tests or in the future, they may add additional code samples around UI testing.

Edit: Link to Jetnews UI Tests

takahirom
  • 1,934
  • 2
  • 12
  • 21
Sebastian Helzer
  • 839
  • 7
  • 12
  • Worth noting that currently there's no way to report on Code Coverage when doing Instrumented Tests with JetpackCompose's Components - so if a code coverage report is something you're interested on you might want to subscribe to [this GitHub issue](https://github.com/jacoco/jacoco/issues/1208) for updates. – Alves RC Aug 07 '22 at 14:00
2

In goo.gle/compose-testing you'll find the official documentation.

Most of the official code samples have UI tests. Apart from the common UI checks in JetNews, you can find animation+screenshot tests in Rally, Interop tests in Crane, screen recreation and navigation tests in Jetchat, etc.

Jose Alcérreca
  • 1,809
  • 17
  • 20