setting up android uiautomator

create the ant build file:

C:\>android create uitest-project -n myprojectname -t 1 -p c:\code\myproject

build the test code:

cd c:\code\myproject

ant build

push (upload) it to the device:

C:\code\myproject>adb push c:\code\myproject\uitest\bin\myprojectname.jar /data/local/tmp/

run the test:

C:\code\myproject>adb shell uiautomator runtest myproject.jar -c example.Test

have to have junit3 jar file to write the code. not sure if the generated build file references this somewhere in the android dev kit or if it can pick it up from my project files. had it in the libs dir. but finding it was a bit hard as the only thing available seems to be junit4 not. but found it in the maven central repo.

nice thing seems to be that you can run almost any code as part of this special type of test case uploaded. no need to fiddle with permissions or anything. also logging works fine and system.out seems to print on the pc console? great, although i might be just mistaken..

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s