Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIAutomator running with espresso

I am currently testing an application that should be set as the default launcher.

I already have a set of Espresso tests running, but they only work if the user has previously selected my app as the launcher.

The dialog that appears to the user so that he can select the launcher is not reachable by Espresso, since it is outside the app itself. However, UIAutomator would be perfectly able to interact with it.

Hence, I would like to know if it is possible to use some kind of UIAutomator script before the Espresso tests.

like image 684
lage Avatar asked Dec 19 '22 09:12

lage


2 Answers

Since UIAutomator 2.0 is now based on Android Instrumentation, you can run Espresso and UIAutomator tests in one test suite, for example. You can play with test methods naming to run UIAutomator tests first and then run other Espresso stuff. More about UIAutomator 2.0 and how to use it together with Espresso here.

like image 82
denys Avatar answered Jan 07 '23 08:01

denys


I have no experience yet with uiatomator, but I can provide you some useful links to start. Here they are:

To get more information about uiautomator visit these site:

  • https://google.github.io/android-testing-support-library/docs/uiautomator/index.html
  • http://developer.android.com/intl/es/training/testing/ui-testing/uiautomator-testing.html
  • http://www.tutorialspoint.com/android/android_ui_testing.htm

If you're looking for how to integrate Espresso with uiatomator visit:

https://testyour.app/blog/espresso-uiautomator

Hope it help

like image 41
piotrek1543 Avatar answered Jan 07 '23 10:01

piotrek1543