Proof of concept for automated UI testing of a Rust GUI application using Python and platform-native accessibility APIs.
- Linux: Uses AT-SPI (Assistive Technology Service Provider Interface)
- Windows: Uses Windows UI Automation API
├── app/ # Rust GUI application (eframe/egui)
│ ├── src/
│ └── Cargo.toml
├── tests-linux/ # Linux UI automation tests (AT-SPI)
│ ├── test_ui_automation.py
│ └── requirements.txt
└── tests-windows/ # Windows UI automation tests (UI Automation)
├── test_ui_automation.py
└── requirements.txt
Install Rust (all platforms):
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shLinux GUI dependencies (Ubuntu/Debian):
sudo apt-get update
sudo apt-get install -y \
libgtk-3-dev \
libxcb-render0-dev \
libxcb-shape0-dev \
libxcb-xfixes0-dev \
libxkbcommon-dev \
libssl-devWindows: No additional dependencies needed for the app.
Linux (Ubuntu/Debian):
sudo apt-get install -y \
at-spi2-core \
python3-pytest \
python3-pyatspi \
python3-dbusWindows:
cd tests-windows
pip install -r requirements.txtcd app
cargo run --releaseThe application window will show:
- A heading: "Automation Demo"
- A text input field
- A button showing click count
Important: Tests must be run in a graphical session (not over SSH).
cd tests-linux
pytest -v -sRun specific test:
cd tests-linux
pytest -v -s test_ui_automation.py::test_click_buttonNote: If you get display errors, set the DISPLAY variable:
DISPLAY=:0 pytest -v -sThis is only needed if running from SSH or a terminal without $DISPLAY set.
cd tests-windows
pytest -v -sRun specific test:
cd tests-windows
pytest -v -s test_ui_automation.py::test_click_buttonRust GUI app built with eframe/egui and AccessKit for cross-platform accessibility support.
- Uses
pyatspilibrary to interact with AT-SPI - AT-SPI is the Linux accessibility protocol that exposes UI elements
- AccessKit bridges the Rust app to AT-SPI
- Uses
pywinautolibrary to interact with Windows UI Automation API - Windows UI Automation is the native Windows accessibility framework
- AccessKit bridges the Rust app to Windows UI Automation
Use Accerciser to inspect the accessibility tree:
sudo apt-get install accerciser
accerciserUse Inspect.exe (included with Windows SDK) to inspect the UI Automation tree:
- Press
Win + R, typeinspect.exe, press Enter - Or download from Windows SDK
Alternative: Use the Windows Accessibility Insights tool
| Feature | Linux | Windows |
|---|---|---|
| Library | pyatspi |
pywinauto |
| API | AT-SPI | UI Automation |
| Find App | Desktop tree search | Window title match |
| Find Button | Role-based | Control type |
| Click | queryAction().doAction(0) |
.click() |
MIT