0

Currently I use UIAutomator to perform Android UI testing. Basically, I write Java code, compile it, install the jar, and run.

Suppose the UI test app (read UI operations from xml file) is called AppTester.jar, which is used to test the developed app, called myApp.apk. Then I have to run:

adb shell uiautomator runtest AppTester.jar -c com.uia.example.my.AppTester

Therefore, all tests are done on device, not from terminal, after running adb command.

Now I want to use AndroidViewClient for view comparison somewhere in my existing tests. In order to integrate AndroidViewClient into the existing testing framework, it would be ideal if I could run the script (generated by culebra) even the culebra tool that generates the script in my AppTester.jar program.

Is it possible to do that?

realmq
  • 429
  • 4
  • 18

1 Answers1

1

uiautomator tests must be run from adb, so you won't get rid of it. Then you still need your computer to run the tests so it would not be a big difference to run AndroidViewClient/culebra generated tests on the device when you still need adb to run the other tests.

Having said that, perhaps there's a way using SL4A although, I haven't tried it. As AndroidViewClient/culebra tests are entirely in python and they depend on very few modules perhaps there's a chance.

Next tool generation, which is called Culebra Tester (under private beta now) has the same abilities of culebra but additionally can generate not only python but also Java so you will have no problem unifying your tests. It runs completely on the device, so the only external requirement is a browser.

The demonstration video shows the generation of a simple UiAutomator test.

Diego Torres Milano
  • 65,697
  • 9
  • 111
  • 134
  • @dtmilano, to better refine my question, can I reuse the code written in Culebra that dumps/compares the tree of views and wrap this part in an application, which will do the same thing on the device? Does not work on production hardware or it only works on a android simulator, requiring server/client structure? – realmq Apr 28 '16 at 18:39
  • As I mentioned in my answer, you need some permissions in your tests that are only granted if you run them from `adb`. What tests started from an application could do is limited by the permissions. Imagine any app could access the Views of other apps, it would be a huge security problem. – Diego Torres Milano Apr 28 '16 at 19:56
  • @dtmilano, I understand uiautomator must be run from adb. The ability I want to have is that once uiatumator runs my AppTester.jar (adb shell uiautomator runtest AppTester.jar -c com.uia.example.my.AppTester), I could run culebra script (or java code) from within my AppTester.jar, suppose I reuse the culebra code and wrap it properly into AppTester.jar. Is Culebra Tester or a work around python (culebra python script) able to achieve that? – realmq Apr 28 '16 at 22:52