Robot Framework library for Android ADB interaction
Project description
ADBLibrary for Robot Framework
ADBLibrary is a custom Robot Framework library that provides Android Debug Bridge (ADB) functionalities for automated testing and device control.
It enables seamless interaction with Android devices through ADB commands, making it ideal for client-side testing, device orchestration, and CI/CD pipelines.
Features
- Execute
adbandadb shellcommands - Manage multiple connected Android devices
- Switch between USB and TCP/IP connections
- Install, uninstall, and inspect APKs
- Capture logs, screenshots, and device metadata
- Simulate input events and browser interactions
- Push/pull files between host and device
- Root/unroot access control
- Built on a proxy design pattern for scalable multi-device support
PREREQUISITES
Before using this library, ensure the following are installed on your system:
-
ADB (Android Debug Bridge)
ADB is required to communicate with Android devices.
On Ubuntu/Debian systems:
$ sudo apt-get update $ sudo apt-get install adb
On macOS using Homebrew:
$ brew install android-platform-toolsAlternatively, download ADB tools from: https://developer.android.com/studio/releases/platform-tools
-
Root Access (IMPORTANT)
If you want to access the full set of functionalities provided by ADBLibrary, your Android device must be connected with root access enabled.
Supported Devices
| Device Type | Supported Features |
|---|---|
| Rooted | Full access to all keywords |
| Unrooted | Limited access: connection, shell commands, metadata queries |
INSTALLATION
-
Clone the repository (if not already):
$ git clone https://github.com/yourusername/ADBLibrary.git $ cd ADBLibrary -
Install Python dependencies:
$ pip install -r requirements.txtNote: It is recommended to use a virtual environment.
-
(Optional) Reload your profile if 'adb' is not recognized:
$ source ~/.profile
SETUP
Refer to the following setup diagram to connect your Android device and verify ADB:
EXAMPLE USAGE IN ROBOT FRAMEWORK
*** Settings ***
Library ADBLibrary
*** Variables ***
${ADB_DEVICE} 10000000cd0c07a6
${DEVICE_IP} 192.168.1.103
${PORT} 5555
${ADB_NETWORK_DEVICE} ${DEVICE_IP}:${PORT}
${INTERFACE} wlan0
${PACKAGE} com.joeykrim.rootcheck
${TIMEOUT} ${5}
*** Test Cases ***
TC001 - Basic ADB Operations
[Documentation] Verifies core ADB operations including starting the ADB server, creating a USB connection,
... executing shell and ADB commands, and disconnecting the device.
Start Adb Server
Create Connection type=usb device_id=${ADB_DEVICE}
${model} Execute Shell Command getprop ro.product.model
Log To Console \nModel: ${model}
${version} Execute Command adb shell getprop ro.build.version.release
Log To Console \nAndroid Version: ${version}
Disconnect Device
TC002 - Network Connection and Device Metadata
[Documentation] Verifies network-based ADB connection setup. Includes enabling TCP/IP mode, creating a
... network connection, retrieving Android version, switching between devices, and fetching
... device metadata such as build product, hardware name, state, and serial number.
Create Connection type=usb device_id=${ADB_DEVICE}
Enable Tcpip Mode port=${PORT}
Create Connection type=network device_ip=${DEVICE_IP} port=${PORT}
${version} Get Android Version
Log To Console \nAndroid Version: ${version}
Switch Connection device_id=${ADB_DEVICE}
${connection} Get Connection
Log To Console \nCurrent Connection: ${connection}
${product} Get Build Product
Log To Console \nBuild Product: ${product}
${hardware} Get Hardware Name
Log To Console \nHardware Name: ${hardware}
${state} Get State
Should Be Equal ${state} device
${serial_number} Get Serial Number
Should Be Equal ${serial_number} ${ADB_DEVICE}
Close All Connections
PROJECT STRUCTURE
ADBLibrary/
├── doc/
│ └── ADBLibrary.html # Auto-generated keyword documentation (via libdoc)
│ └── IMAGE1.png # Optional setup or architecture diagram
├── LICENSE.txt # Apache License 2.0
├── README.md # Project overview and usage instructions
├── requirements.txt # Python dependencies
├── setup.py # Packaging and distribution configuration
├── src/
│ ├── ADBLibrary/
│ │ ├── adb_library.py # Main Robot Framework library class (with @library decorator)
│ │ └── __init__.py # Entry point for libdoc and version declaration
│ ├── core/
│ │ ├── adb_connection.py # Low-level ADB connection handling
│ │ ├── adb_interface.py # Interface definitions and command abstractions
│ │ ├── adb_proxy.py # Proxy design pattern for multi-device orchestration
│ │ └── __init__.py # Core module initializer
│ └── __init__.py # Root src initializer (optional for packaging)
└── test/
└── test.robot # Sample Robot Framework test suite using ADBLibrary
DOCUMENTATIONS
Refer to the following file for help with the available functionalities in the ADBLibrary:
You Can regenerate this using:
$ libdoc ADBLibrary ADBLibrary.html
LICENSE
This project is licensed under the Apache License 2.0. https://www.apache.org/licenses/LICENSE-2.0
CONTRIBUTIONS
Contributions are welcome! Feel free to:
- Submit pull requests
- Open issues
- Suggest new keywords or enhancements
Let’s build a powerful ADB automation ecosystem together.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file robotframework_adblibrary-0.1.3.tar.gz.
File metadata
- Download URL: robotframework_adblibrary-0.1.3.tar.gz
- Upload date:
- Size: 26.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7724d5cdc3eb3a8fd560e5e7e63387e5a624ad4ab82ab18fdf39803bd155bdf1
|
|
| MD5 |
4ceffad322d69fb1b5334ffe952be130
|
|
| BLAKE2b-256 |
37178a5a30dd24316d54062458f86eff3bae7f9aef9f457852b8bb2f44834866
|
File details
Details for the file robotframework_adblibrary-0.1.3-py3-none-any.whl.
File metadata
- Download URL: robotframework_adblibrary-0.1.3-py3-none-any.whl
- Upload date:
- Size: 26.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93056acb3bee65aa0903e34c0247786e7384db7b6f1f4b0ac3426550a39f771c
|
|
| MD5 |
d948f0bb29c7a5fc64ec2417a96d612c
|
|
| BLAKE2b-256 |
26a296cc52b6f7b845bcb8873aec365ed7ebc0725c18c72cb71814cf5c2f4ad2
|