Skip to main content

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 adb and adb shell commands
  • 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:

  1. 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-tools
    

    Alternatively, download ADB tools from: https://developer.android.com/studio/releases/platform-tools

  2. 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

  1. Clone the repository (if not already):

    $ git clone https://github.com/yourusername/ADBLibrary.git
    $ cd ADBLibrary
    
  2. Install Python dependencies:

    $ pip install -r requirements.txt
    

    Note: It is recommended to use a virtual environment.

  3. (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:

Setup


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:

ADBLibrary Keyword Reference

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.

Metadata

Release files for robotframework-adblibrary 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for robotframework-adblibrary 0.1.3
File Size Uploaded Provenance
robotframework_adblibrary-0.1.3.tar.gz 26.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for robotframework-adblibrary 0.1.3
File Interpreter ABI Platform
robotframework_adblibrary-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 53.0 kB

Release files / robotframework_adblibrary-0.1.3.tar.gz

Download URL robotframework_adblibrary-0.1.3.tar.gz
Size 26.9 kB
Tags Source
SHA-256 checksum
How to use checksums
7724d5cdc3eb3a8fd560e5e7e63387e5a624ad4ab82ab18fdf39803bd155bdf1
BLAKE2b-256 checksum
How to use checksums
37178a5a30dd24316d54062458f86eff3bae7f9aef9f457852b8bb2f44834866
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.12

Release files / robotframework_adblibrary-0.1.3-py3-none-any.whl

Download URL robotframework_adblibrary-0.1.3-py3-none-any.whl
Size 26.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
93056acb3bee65aa0903e34c0247786e7384db7b6f1f4b0ac3426550a39f771c
BLAKE2b-256 checksum
How to use checksums
26a296cc52b6f7b845bcb8873aec365ed7ebc0725c18c72cb71814cf5c2f4ad2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.12

Security for robotframework-adblibrary 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page