Testing

← Back to index

Weva has ~1900 NUnit tests, all written to run headlessly — the layers above the render-backend boundary have no Unity dependency, so the suite runs either in the Unity Test Runner (once the package is added to a project) or via standalone dotnet tools that link the same source.

Suite layout

Tests live under Packages/com.weva/Tests/:

Coverage convention (from MEMORY/PLAN): each new component gets extensive NUnit coverage, not smoke tests. The incremental path of every stage is tested to produce results identical to the from-scratch "naive" oracle.

Running headlessly with dotnet

Two standalone runners under Tools/ link the package source directly so you don't need to open Unity:

Golden-image tests

Tests/Runtime/Goldens/ runs Parser → Cascade → Layout (with deterministic mono font metrics) → Converter → a headless SoftwareRasterizer (IRenderBackend) and compares the PNG output against committed baselines. A hand-rolled PNG writer/reader keeps it dependency-free. GoldenRunner orchestrates; set UNITYUI_REGENERATE_GOLDENS=1 to refresh baselines after an intentional visual change.

Layout-vs-Chrome audit

Layout fidelity is checked against headless Chrome (Puppeteer) rather than hand-authored expectations:

Caveat: Weva's font metrics differ from Chrome's by design (Segoe UI default, not Arial — see Text & Fonts), so a few px of line-height difference cascades into uniform y-shifts. Those font-drift rows are accepted divergence; only structural deltas are treated as bugs.

Perf benches

Tests/Runtime/Bench/ holds the standardized benches (CascadeBench, LayoutBench, PaintBench, EndToEndBench), all [Test, Explicit("perf")] so they're off the default pass. Tools/PerfBench/ is the standalone runner: dotnet run -c Release -- all emits a markdown table; --baseline <path.json> compares against a prior run. Fixtures scale from 100 cards to 5000 elements.

Profiling

Runtime/Profiling/UIProfilerMarkers.cs declares ProfilerMarkers for every pipeline phase (Weva.Cascade.*, Weva.Layout.*, Weva.Paint.*, etc.). They compile to no-ops outside UNITY_EDITOR || DEVELOPMENT_BUILD unless UNITYUI_PROFILE is defined; in instrumented builds the breakdown shows up in the Unity Profiler under Scripting.


← Back to index