Testing and diagnostics

UI bugs are rarely just a pure function returning the wrong value. They can involve state transitions, focus order, layout, scrolling, overlays, timing, rendering, or the platform host. Fission keeps those runtime stages inspectable so you can test the layer where the bug lives.
Start with the cheapest test that can answer the question, then move closer to the real host when you need more confidence:
1.
reducer tests,
2.
headless harness tests,
3.
live shell tests,
4.
diagnostics and stage-level investigation.
That order matters. You should not open a real window to test a pure state transition, and you should not reach for screenshots when a geometry assertion would say more with less noise.

Why determinism changes the testing story

In Fission, the same inputs are supposed to produce the same results.
That is not only a rendering claim. It includes state evolution, layout, semantics, paint order, and action flow. Because the runtime owns those stages explicitly, tests can inspect them directly instead of treating the whole user interface as a pile of opaque pixels.
This is what makes the layered testing strategy work. You can choose the cheapest test that still matches the question you are asking.

Start with reducer tests

Reducer tests are the smallest and cheapest tests in a Fission app.
A reducer test answers one focused question: given this starting state and this action, did the state change correctly?
That is the right layer for business rules, validation logic, toggles, counters, workflow flags, and many error-handling branches. If the question does not require layout, semantics, or rendering, keep it at the reducer level.
The benefit is speed and clarity. A reducer test fails close to the logic that caused the bug.
This orchestration test assumes the app defines EditorState, the generated SaveRequested action, and on_save_requested handler. The generated handler takes the action and context even when a simpler state helper would not:
use fission::core::{ActionInput, ActionRegistry, Effects, ReducerContext};

#[test]
fn save_request_marks_state_as_saving() {
    let mut state = EditorState::default();
    let mut registry = ActionRegistry::new();
    let mut effects = Effects::new(1, &mut registry);
    let input = ActionInput::None;
    let mut ctx = ReducerContext {
        effects: &mut effects,
        input: &input,
    };

    on_save_requested(&mut state, SaveRequested, &mut ctx);

    assert!(state.saving);
    assert_eq!(effects.out.len(), 1);
}
Use reducer tests when you care about state transitions and emitted effects.
Do not use reducer tests when the question is really about layout, visibility, semantics, or text input behavior. A reducer test cannot tell you whether a modal was actually placed correctly on screen.
A common mistake is trying to re-create too much runtime behavior inside a reducer test. Keep these tests narrow.

Move to headless harness tests when structure matters

Once the question becomes "what did the user interface build, lay out, or expose semantically?" you are in harness-test territory.
The fission-test crate gives you a headless runtime environment. It can build widgets, run layout, pump frames, drive interactions, and inspect output without opening a real window or graphics processing unit (GPU) surface.
That is the right layer for questions such as:
•
Is this button visible after a reducer change?
•
Did the layout place the drawer where we expect?
•
Does the semantic tree contain the right label and role?
•
After typing text, does the reconverted user interface show the expected result?
It exercises the real runtime model while staying faster and more controllable than a live shell test.
fission-test provides tools such as TestHarness, HeadlessApp, and TestDriver. They give you predictable build, lower, layout, pump, and query flows. The driver can tap, type, scroll, and inspect visible text or semantics in process.
Use harness tests when structure, geometry, semantics, or headless interaction behavior matters.
Do not use them when you need to validate the behavior of a real host window, a platform launcher, or a shell-specific integration boundary.
A common mistake is falling back to screenshots too early. If the real question is whether the button is visible, focusable, or left of another label, ask the harness directly.

Use live shell tests when a real host matters

Live shell tests are for the cases where the headless harness is no longer enough.
Sometimes you need a real shell. Maybe you care about overlay behavior in a real presented window. Maybe you want screenshots from the live host. Maybe you are validating shell-managed input flow or a target launch path.
That is where fission-test-driver::LiveTestClient fits. Native shells use the loopback Hypertext Transfer Protocol test-control server. Web tests use the same client and command protocol through a test-only Chromium bridge.
In practice, the app is launched with FISSION_TEST_CONTROL_PORT=<port>, and the live client sends commands such as tap, type, scroll, screenshot, get visible text, get the semantic tree, pump, or simulate a resize.
This is the right layer for end-to-end interaction flows and real-window validation.
Use live tests when you need confidence that the app behaves correctly in a running shell.
Do not use live tests for logic that a reducer or harness test can already prove. Real shells are slower, more operationally involved, and more expensive to maintain.
The Web bridge is present only in Web test builds. The initial browser driver supports Chromium and deterministic Fission input; other browsers and trusted browser clipboard, file, accessibility, and IME integration remain separate host-specific work.
A common mistake is using live tests as the first answer to every user interface question. They should sit above simpler layers, not replace them.

Target smoke tests are not the same thing as live behavior tests

The repo also includes target smoke scripts and generated host launchers. These matter, but they answer a narrower question.
A target smoke test proves that a browser, Android, or iOS host path builds and launches correctly through the documented wrapper. It does not replace reducer tests, harness tests, or structured live interaction tests.
Think of smoke scripts as host validation. Think of harness and live tests as behavior validation.
You need both, but they solve different problems.

Diagnostics help when you need stage-level evidence

Diagnostics are what you reach for when you already know the bug is not just "the user interface looks wrong." You need to know which runtime stage first diverged.
The fission-diagnostics crate emits structured events for the major parts of the frame lifecycle. Instead of only logging arbitrary strings, it gives the runtime a vocabulary for what happened during a frame.
The category names are easiest to understand if you group them by purpose.
Some categories describe pipeline stages: Frame, Diff, Layout, Paint, and Raster. These tell you how the frame moved through the internal pipeline and where work changed.
Some categories describe interaction and motion: Input and Animation tell you what the runtime heard and how motion evolved.
Some categories describe special runtime surfaces or correctness boundaries: Media tracks embed-related activity, Semantics is reserved for accessibility-oriented events, Invariants reports consistency violations, and Test is reserved for harness or testing events.
That structure matters because it turns diagnostics into a guided investigation instead of a single undifferentiated log stream.

How to turn diagnostics on

Diagnostics are configured through environment variables.
The most important ones are:
•
FISSION_DIAG to choose categories,
•
FISSION_DIAG_LEVEL to choose severity,
•
FISSION_DIAG_SINK to choose where events go,
•
FISSION_DIAG_SAMPLING to control sampling.
A practical example looks like this:
FISSION_DIAG=layout,paint,frame \
FISSION_DIAG_LEVEL=debug \
FISSION_DIAG_SINK=file:.artifacts/fission.jsonl \
cargo run -p counter
Create .artifacts/ first and retain only the diagnostic categories needed for the failing path. A local app with a different package name should run its own package rather than copying -p counter unchanged.
Use diagnostics when you need evidence such as these:
•
did layout reconvert more than expected,
•
did paint order change,
•
did input arrive in the expected order,
•
did animation state advance the way you thought,
•
did an invariant failure reveal the first real problem.
Do not turn diagnostics into a substitute for clear tests. Diagnostics help you investigate and explain failures. Tests are still the main way you lock behavior down.

A practical testing workflow

For most features, a healthy sequence looks like this.
Write reducer tests for the important state transitions first. Add harness tests for layout, semantics, and interaction behavior that needs the runtime. Add live tests for critical real-shell flows, overlays, or screenshots. Use target smoke scripts when a browser or mobile host path itself needs validation. Turn on diagnostics when a failure needs stage-level evidence.
This workflow keeps tests cheap for as long as possible while still letting you go deep when necessary.

Common mistakes to avoid

One common mistake is skipping straight to screenshots. Pixel comparisons have a place, but they are usually not the clearest first proof.
Another mistake is testing reducer logic through full live-shell flows. That creates slow tests that fail far from the real bug.
Another frequent issue is sleeping in tests instead of using harness pumping, timer payloads, or live-driver commands that align with the runtime model.
A fourth mistake is treating target smoke scripts as complete behavior coverage. They only prove host launch, not the full app behavior inside the host.
Finally, avoid diagnostics spam without a question. Enable the categories that match the investigation you are actually running.

Where to go next

If you want the shell-side picture for target generation, host launchers, and public shell builders, read Platform shells, command-line interface, and testing. If you want the async model behind many live app behaviors, continue to Resources and async.

Golden images and visual fidelity

For visual regressions, use LiveTest screenshots and fission-test-driver golden comparisons. Resize the real host, wait for a stable frame, drive the UI through semantic selectors, then compare the screenshot with GoldenOptions.
This is the recommended path for responsive QA, app-store screenshots, chart galleries, marketing pages, and any screen where design-system tokens, packaged fonts, gradients, shadows, or text wrapping are part of the contract. See Golden image testing and Responsive visual QA.