How run ADB Commands in Robot Framework

1,685 views
Skip to first unread message

Pierre Patey

unread,
Jan 29, 2018, 9:24:01 AM1/29/18
to robotframework-users
What is the syntax of an ADB command to run it via Robot Framework and retrieve the result in a variable

Tatu Aalto

unread,
Jan 29, 2018, 10:49:43 AM1/29/18
to pierre...@gmail.com, robotframework-users
Ugh

If you plan to do really simple ADB commands which do not generate more than few lines of output and are planning to do less than four ADB commands/keywords, then I would look to the Process [1] library direction. But I did write a library around ADB, by using Python subprocess[2] library, which allowed me to do more complex commands, capture errors better and handle large output in unified way. Also writing a library allowed to use devices which are attached to the the local PC and in some cloud provider in unified manner.

When I now think about the problem, writing a library and open source the library would be nice idea. Unfortunately I don't anymore work for the company where I did write the library, so I am not anymore able to do it. But I can recommend the subprocess and writing a small library on top of it, it really did pay off in the long run.

On Jan 29, 2018 16:24, "Pierre Patey" <pierre...@gmail.com> wrote:
What is the syntax of an ADB command to run it via Robot Framework and retrieve the result in a variable

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.
To post to this group, send email to robotframework-users@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

Alex C.

unread,
Feb 8, 2018, 3:27:28 AM2/8/18
to robotframework-users
It would most definitely make sense to imlpement an adb test library for this, as there you can parse your output (if needed), handle exceptions and even support multiple devices - we have 3 different phones connected to a device thus I work with device id's.

To answer an incoming call:

subprocess.call(['adb', '-s', devid, 'shell', 'input', 'keyevent', 'KEYCODE_CALL'])
Reply all
Reply to author
Forward
0 new messages