u/Aathif_Mahir

Introducing Pulse — in-app conformance testing for Blazor
▲ 24 r/dotnetMAUI+1 crossposts

Introducing Pulse — in-app conformance testing for Blazor

I’m building Pulse, a small .NET test runner for conformance tests that run inside a real app host.

For Blazor WebAssembly, the goal is to test behavior that dotnet test can’t honestly prove: real IJSRuntime, imported JS modules, browser storage, host HttpClient, DI, and runtime services while the app is actually running in the browser.

The pattern:

  • put shared specs in *.TestSupport
  • run them against fakes with dotnet test
  • run the same behavior inside a real Blazor app with Pulse

example:

public abstract class TokenStorageSpec
{
    protected abstract ITokenStorage Storage { get; }

    protected async Task RoundTrips(CancellationToken ct)
    {
        await Storage.StoreAsync("auth", "abc", ct);
        if (await Storage.RetrieveAsync("auth", ct) != "abc")
            throw new InvalidOperationException("Token did not round-trip.");
    }
}

public sealed class BrowserStorageSuite(ITokenStorage storage) : TokenStorageSpec
{
    protected override ITokenStorage Storage => storage;

    [PulseCase(TimeoutMs = 5000)]
    public Task LocalStorage_round_trips(CancellationToken ct) => RoundTrips(ct);
}

So the fake-backed test proves the rule in dotnet test, and Pulse proves the same rule through the real browser/runtime boundary.

Pulse is intentionally small: one NuGet package, no Blazor-specific package, no Test Explorer integration, no UI framework, and it returns a structured TestRunReport.

It’s preview-stage. I’m still figuring out the right direction before calling it stable. The focus is conformance testing for app/runtime boundaries, not replacing unit tests or UI automation.

Specs/rules: https://github.com/Circuids/Pulse/blob/master/docs/conformance-specs-and-rules.md

GitHub: https://github.com/Circuids/Pulse

NuGet: Circuids.Pulse

Feedback welcome, especially from people building Blazor apps with JS interop, browser storage, host wiring, or runtime behavior that is awkward to verify in normal tests.

u/Aathif_Mahir — 4 days ago
▲ 19 r/Blazor

If you've ever built a shared Razor Class Library that runs in both Blazor WebAssembly/Server and MAUI Blazor Hybrid, you know the pain: platform checks scattered in markup, duplicated layout logic, and no clean way to ask simple runtime questions like "am I on a phone?" or "is the user offline?"

Bridge is a production-ready open-source library that solves this cleanly.

It gives your shared Razor components a unified service layer for:

  • Host detection — Blazor vs MAUI vs WPF vs WinForms
  • Platform detection — Android, iOS, Windows, Mac, Linux
  • Form factor — phone, tablet, or desktop, with live resize support
  • Connectivity — online/offline state with polling or native detection
  • Theme — light/dark mode, reactive to system changes
  • Safe area — notch, cutout, and gesture area insets

The entire API surface is the same across Blazor WebAssembly, Blazor Server, and MAUI Blazor Hybrid. Your shared UI adapts at runtime through components and injectable services — no platform #if blocks, no duplicated pages.

<BridgeFormFactor Context="viewport">
    <Phone><MobileDashboard /></Phone>
    <Tablet><CompactDashboard /></Tablet>
    <Desktop><FullDashboard /></Desktop>
    <Default><LoadingLayout /></Default>
</BridgeFormFactor>

<BridgeSafeArea Context="insets">
    <div style="padding: @(insets.Top)px @(insets.Right)px @(insets.Bottom)px @(insets.Left)px">
        <MainShell />
    </div>
</BridgeSafeArea>

Getting started is two lines — register the implementation for your host, wrap your app tree with <BridgeProvider>, and you're done.

Bridge is the production rewrite of my earlier experimental package MauiBlazorBridge, built from the ground up with a stable API, full component test coverage, and conformance tests that validate behavior in real host apps.

Available on NuGet:

  • Circuids.Bridge.Blazor — for Blazor WebAssembly and Blazor Server
  • Circuids.Bridge.Maui — for MAUI Blazor Hybrid
  • Circuids.Bridge — for shared Razor Class Libraries

GitHub: https://github.com/Circuids/Bridge

Feedback, issues, and contributions are very welcome. Would love to hear how people are using shared Blazor UI across targets.

u/Aathif_Mahir — 17 days ago