Thursday, April 11, 2013

[android help] Cannot run android ui tests from command line


Can you confirm whether the adb push actually transfers the file correctly? There are a couple of ways to check this:


  1. Check the output of the adb push command e.g. adb push bin/UIAutomatorExample.jar /data/local/tmp/ In my case the output is 1011 KB/s (5854 bytes in 0.005s) (the evidence is the number of bytes transferred. Here we know something was sucessfully transferred somewhere).

  2. Use adb shell to check the file is available in the expected location: adb shell ls -l /data/local/tmp/*.jar Here is the output for my example -rw-rw-rw- shell shell 5854 2013-04-11 01:36 UIAutomatorExample.jar Note: the file size in bytes matched the figure from the first command output, 5854 bytes.

Once we know the jar file has been successfully deployed to the correct location the run command should work, provided the target device is running version 16 or later of Android APIs. (although in practice 17 is the first version of Android where UIAutomator seems to work reliably.)


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


Of course you need to replace LaunchSettings.jar with TestProject.jar :)


PS: in your example I just noticed the 'missing file' has a different filename from the one you deployed to the device: You push TestProject.jar however the 'missing file' is shown as TerranovaTests.jar - perhaps you could double-check your commands to make sure they're using the same filename?



.

stackoverflow.comm

No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...