Slint UI Testing with Python
Use the Slint UI Testing module to launch a Slint application locally or on a remote machine via SSH, inspect its UI, trigger actions, and verify correct behaviour.
This documentation describes slint_testing 0.6.1.
Prerequisites
Section titled “Prerequisites”- Python 3 ↗
- uv ↗
- Slint 1.17 or newer.
Your application needs to be built with system testing support:
- For Rust applications, enable the
system-testingfeature of theslintcrate. - For C++ applications, set
SLINT_FEATURE_SYSTEM_TESTING=ONin your CMake configuration.
In addition, the SLINT_EMIT_DEBUG_INFO=1 environment variable must be set
during the application build process. We anticipate that this requirement will
be lifted in favor of an easier mechanism in the future.
Installation
Section titled “Installation”slint_testing is distributed through Slint’s package index at
testing.slint.dev. With your license you receive an access token.
-
Give the token to uv, once per machine:
Terminal window uv auth login https://testing.slint.dev/simple/ --token <TOKEN>uv remembers it for
testing.slint.dev, so it never appears in your project. -
Point your project at Slint’s index for
slint-testingonly, inpyproject.toml:[[tool.uv.index]]name = "slint-private"url = "https://testing.slint.dev/simple/"explicit = true[tool.uv.sources]slint-testing = { index = "slint-private" }explicit = truekeeps PyPI as the default for everything else. The URL holds no token, so commit this even if your repository is public. -
Add the package:
Terminal window uv add slint-testing
Continuous integration
Section titled “Continuous integration”Store the token as a repository secret. uv reads the credentials for an index
from environment variables named after it (slint-private → SLINT_PRIVATE),
so no uv auth login is needed. For GitHub Actions:
- uses: astral-sh/setup-uv@v6 with: enable-cache: true- run: uv sync env: UV_INDEX_SLINT_PRIVATE_USERNAME: __token__ UV_INDEX_SLINT_PRIVATE_PASSWORD: ${{ secrets.SLINT_TESTING_TOKEN }}For a complete workflow that runs tests on Linux, macOS, and Windows, see the CI workflow ↗ of the examples.
Token in the index URL
Section titled “Token in the index URL”The token also works in the index URL, https://testing.slint.dev/t/<TOKEN>/,
without uv auth login. uv then writes that URL, token included, into
uv.lock, so keep it out of public repositories.
import slint_testing
with slint_testing.Application(["/path/to/my_app"]) as aut: window = aut.first_window
root_element = window.root_element celsius_field = root_element.query_descendants().match_id("App::celsius-input").find_first() convert_button = root_element.query_descendants().match_id("App::convert-button").find_first() fahrenheit_field = root_element.query_descendants().match_id("App::fahrenheit-input").find_first()
celsius_field.accessible_value = "100" convert_button.invoke_accessible_default_action()
assert fahrenheit_field.accessible_value == "212"The slint_testing module provides an Application class, which
wraps the Application Under Test (AUT). Construct it with the command line
arguments needed to launch the compiled application, and use it with Python’s
with ↗ statement.
Before entering your block, the application is launched and slint_testing
waits until the first window is shown and connected.
Fetch the Window from the Application, and then its
root_element. Use query_descendants
to initiate a query into the entire tree of elements, refine it for example via
match_id and finally obtain Element
references to the UI elements by calling find_first
or find_all.
Use Element‘s API to change state via accessible actions, verify
size and position, as well as accessible properties.
Examples
Section titled “Examples”The ui-testing-examples ↗ repository contains example applications written in Rust, C++, Node.js, and Python, each with a suite of tests. They show how to build an application with system testing support, launch it from pytest fixtures, and find and interact with elements. Each example is self-contained, so you can copy its directory as a starting point for your own project.
Networking
Section titled “Networking”The slint_testing module and the AUT are connected via a TCP connection and
exchange messages. slint_testing creates a listening TCP socket and passes the
address to the AUT via the SLINT_TEST_SERVER environment variable. The AUT,
when enabled for system testing, will automatically attempt to connect to the
listening TCP socket when the first window is shown. This assumes readiness of
the application, similar to how visibility on the screen indicates readiness to
an end-user.
When launched via SSH, slint_testing configures SSH to open a listening socket
on the remote side at port 8091 and configures a remote tunnel to forward to the
local socket slint_testing created.
© 2026 SixtyFPS GmbH