Upgrade to Pro — share decks privately, control downloads, hide ads and more …

.NET Day 2025: Future-Proof Your Blazor Apps wi...

.NET Day 2025: Future-Proof Your Blazor Apps with bUnit

Avatar for dotnetday

dotnetday

August 29, 2025
Tweet

More Decks by dotnetday

Other Decks in Technology

Transcript

  1. Who is this guy? • Hans Muns • Software Developer

    & Microsoft Certified trainer @ Vitas • Newest hobby: Dog owner
  2. The history of Blazor testing 2006 Selenium Release 2018 Blazor

    Release 2020 Playwright Release 2021 bUnit Release
  3. Why do we need a new tool? Relatively slow Not

    designed for component/unit testing Mocking is hard Require browser setup
  4. What is bUnit? It’s not a replacement for xUnit, NUnit,

    TUnit, or any other unit testing framework. It’s an addition.
  5. What is bUnit? Open-source testing library for Blazor components Enables

    ‘regular’ unit testing experience Supported by the .NET Foundation Doesn’t run in the browser, doesn’t run Javascript
  6. Let’s make a plan 1. Third-party components 2. Parameters &

    callbacks 3. Dependency injection . 4. Verifying output.
  7. Even more cool features Faking authorization Emulating JSRuntime Faking persistentComponentState

    Faking NavigationManager Faking IWebAssemblyHostEnvironment InputFile helper to test uploading files
  8. bUnit FAQ Does bUnit replace testing tools like Selenium/Playwright? Are

    there any limitations when using third party components? How can I integrate bUnit in my CI/CD pipelines? How do you go about testing javascript heavy components?
  9. Recap Enables true unit testing Setting up your bUnit project

    Semantic comparison An addition to our testsuite Mocking components Compared to other tools