Trending

World technology news

→
A Dell Latitude laptop displaying the Ubuntu Linux desktop.
crates.ioIn-depth report

icedwright 0.0.1 tests Rust desktop software with virtual time

The first release runs iced 0.14 applications headlessly and locates interface controls by role and name.

·crates.io
Reading progress0%

Run an application without opening a window

icedwright 0.0.1 appeared on crates.io at 23:14:34 UTC on November 28, or 02:14:34 on November 29 in Istanbul. Docs.rs has a separate build record. The Rust archive contains modules for the harness, keyboard and mouse actions, assertions and snapshots. The harness is designed to start an iced 0.14 application headlessly. For example, a test can activate a Save button and inspect the application state after the action has settled.

Virtual time changes how tests wait

The distributed source docs describe a single-threaded Tokio runtime with a paused clock, starting one virtual day ahead of real time. Tasks and subscriptions run on this runtime. Time can advance when there is no runnable work. An application might debounce a search field, then send a query after the last keypress and a delay. A test can observe the state after that pause without requiring the same amount of wall-clock waiting.

Locate a control by its role and name

A test can look for a button by its role and its visible name. This makes the selection less dependent on screen coordinates, which can move when a window changes size. If two panes use the same label, identify the application context or window before selecting the target. In a keyboard interaction, the focused field also matters. A separate check in a real window can cover appearance, layout and platform accessibility behavior.

Read side effects alongside state

The release exports APIs for application state expectations and a fake clipboard, among other features. A copy operation offers two test observations. The interface can acknowledge the action and the test can inspect the value requested for the clipboard. A platform feature such as a file chooser has its own runtime behavior. Record the request produced by the application separately from the result returned by an operating system in a real desktop session.

Try a narrow scenario during adoption

The release inspection confirmed the crate archive and its separate build record, and read the modules for action and state handling. Start with a small scenario that records the input event, the expected message and the final state. A second action can cover what happens when a button is triggered twice. That makes a later change in behavior easy to diagnose. The archival cover shows a computer running Linux in a desktop environment.

Keep selection and timing failures distinguishable

A failure to find a named control and a failure to settle after an action require different investigations. In a small fixture, record the window or pane holding the control, the action given to the harness and the state expected at the end. The separate pieces help track what changed when the same fixture runs against a new application version.

Photo · MarkGallagher~commonswiki / Wikimedia Commons. Resized and converted to WebP. Derivative CC BY-SA 2.5. ↗ · CC BY-SA 2.5

Sources and verification
Be the first reader ✎ Write a comment

Reader discussion

Discussion prompt

What would you change first for maintainability and testing in your own project?

No comments yet. Be the first to contribute.

Write a comment

Comments are real visitor contributions. Repeated, link-heavy or abusive submissions may be limited.