3 ms·
Glad that you found this to be useful! Android includes the Espresso UI testing framework [1]. Essentially, you can specify matchers that compare your expected
by minhmeoke 5y ago
Glad that you found this to be useful!
Android includes the Espresso UI testing framework [1]. Essentially, you can specify matchers that compare your expected values or predicates against an actual object identified by an R.id identifier. It's very powerful (since you can write your own custom matchers) but can be cumbersome to use [2].
[1]
https://developer.android.com/training/testing/espresso/basics https://developer.android.com/training/testing/espresso/basi...
[2] Example Espresso Test:
https://github.com/android/testing-samples/blob/main/ui/espresso/BasicSample/app/src/test/java/com/example/android/testing/espresso/BasicSample/ChangeTextBehaviorLocalTest.java#L47 https://github.com/android/testing-samples/blob/main/ui/espr...
https://github.com/android/testing-samples https://github.com/android/testing-samples
Alternatively, Squish [3] is a very polished and more elegant commercial testing tool that lets you record test-cases using a GUI tool and convert them into (ideally modularized) methods that verify object properties or compare (masked) screenshots of the GUI:
[3] https://www.froglogic.com/squish/features/ https://www.froglogic.com/squish/features/
Demo video (starting at 14:24): https://youtu.be/ElH-3MVHPRw?t=864 https://youtu.be/ElH-3MVHPRw?t=864
They abstract away a lot of the functionality using the Gherkin [4] domain-specific language so that tests are easier to read at a high level (but you can still dig down into the underlying programmatic implementation).
[4] https://cucumber.io/docs/guides/overview/ https://cucumber.io/docs/guides/overview/
This is probably too much complexity for your use-case, but may provide some ideas or inspiration for what is possible. Perhaps a simplified matcher-style system might be a good starting point though.