Testable Properties
Use @testable to mark the properties your UI tests read back.
Testing tools, such as ElementHandle in the slint-testing crate and the MCP server for AI coding assistants, list only @testable properties.
They can’t see any other property, whether it’s in, out, in-out, or private.
The compiler removes unused properties.
It always keeps a @testable property, so your tests don’t break when the optimizer changes.
Syntax
Section titled “Syntax”To expose a property to tests, prefix its declaration with @testable:
component Gauge { // Observed by a test, never read by this document itself. @testable private property <float> internal-load: 0.0; // Public and read, but only exposed to tests because of the annotation. @testable in-out property <float> value: 0.0; // Not listed. in-out property <float> maximum: 100.0;}Semantics
Section titled “Semantics”-
@testabledoesn’t change the property’s visibility or its public API. Aprivateproperty marked@testablestays invisible to Slint code in other components, but tests can read it. -
The compiler keeps the property and its binding, even when nothing in your code reads them.
-
Tests always see the property listed, but not every type has a readable value. A struct property has no value:
Nonein Rust,std::nulloptin C++, and novaluefield in the MCP server’s response. -
Testing tools only see
@testableproperties when you compile your application with debug info. To enable debug info, use one of the following:- the
SLINT_EMIT_DEBUG_INFO=1environment variable with_debug_infoinslint_builddebug_infoinCompilerConfiguration
Without debug info,
@testablehas no runtime cost: the compiler removes an unused@testableproperty like any other. - the
- You can only apply
@testableto property declarations. Callbacks and functions have no value to read. - The compiler rejects
@testableon global and interface properties. Globals have no per-element property table, and interfaces have no runtime element of their own. To make a property that backs an interface member testable, mark the implementing component’s property instead. - You can combine
@testablewith@shadowableand@deprecatedin any order, but use each annotation only once. - When a derived component shadows an inherited property, only the shadowing declaration counts.
If it isn’t
@testable, tests don’t see a property of that name.
© 2026 SixtyFPS GmbH