Skip to main content

Module conformance

Module conformance 

Source
Expand description

Tests that run inside a built Day app (docs/testing.md): a Case is a page plus a drive, or a headless run, declared next to the code it tests with #[day::test] and collected in a registry. The dayscript engine runs them on a real toolkit under day test; the mock harness runs the same functions under cargo test. Nothing here knows how a step is executed: a DriveBackend does, and the engine supplies one.

A test’s name is its function’s, with hyphens for underscores (button_status runs as button-status): the registry entry carries the identifier, so a tool reading the source (day test --list, an editor) and the app agree without either one running the other.

Structs§

Case
One test: what it proves, what it needs, the page it shows and the body that drives it. Built by a #[day::test] function each time the test runs, so the signals a page and its drive share are fresh per run; the registry names it after that function.
Drive
The handle a test drives the app with. Every method awaits the op and fails the test with the step’s own message when the op fails after its retry window.
Fail
A failed assertion, with the sentence the report shows.
FrameExpect
What Drive::assert_frame expects of an element’s frame, in points; only the fields set are checked. x/y are relative to relative_to’s origin, or the window content’s.
NativeExpect
What Drive::assert_native expects the native widget to report; only the fields set are checked (docs/testing.md).
TestFn
A registered test: the function that builds its Case, and that function’s identifier, which is where the test’s name comes from. Declared by #[day::test].

Enums§

DriveOp
What a drive asks of the app, in dayscript’s vocabulary. The engine maps each to the step a script would send, so a drive and a script mean the same thing by the same words.
TestKind
Whether a case shows a page and drives it, or runs with no page.

Statics§

TESTS
Every native #[day::test], collected without runtime constructors.

Traits§

DriveBackend
Executes DriveOps. The engine’s backend runs each as the matching dayscript step on the main thread and waits, asynchronously, through the step’s retry window; the mock harness uses the same backend against the mock toolkit.

Functions§

active
The active case, for the test host to build.
announcements
The announcements made since the run began.
case_named
A fresh case for the test called name, for a person browsing an app’s tests (the conformance app’s navigation does).
cases
Every registered test as a fresh, named Case, sorted by name.
clear_active
Return the test host to the app’s own content.
intercept_open_url
Record url if a test run is intercepting; whether it did.
note_announcement
Record a screen-reader announcement if a test run is going on. Unlike a URL it still goes to the toolkit: announcing has no side effect a run must avoid, and the duty is what a case proves.
note_page_panic
Record a panic the test host caught while building the active case’s page.
opened_urls
The URLs opened (and intercepted) since the run began.
panic_message
The sentence a caught panic’s payload reads as.
register
Add a synthetic case in a test harness. Application tests use #[day::test].
set_active
Show case in the app’s test host, built fresh, until the next call or clear_active. Answers false when the app mounts no test host, so the runner can say so.
set_host
Install the mounted test host’s rebuild (day::test_host does, for the life of its scope); None when it goes.
set_intercepting_urls
Start or end a test run’s interception of crate::open_url: while it is on, a URL the app asks to open is recorded instead of opened, so assert_opened_url can check it and no browser starts on the machine running the tests.
take_page_panic
The panic, if any, the active case’s page raised as it was built.
tests
Every registered test, link-time and run-time ones together.
validate_registry
Fail closed before listing or running compiled tests, independent of test filters.

Type Aliases§

OpFuture
The future one drive op resolves to.
TestResult
What a test’s body answers.