Testing your Blazor apps - quickly and robustly

Online, CEST Time Zone May 27, 2021, 11:20 AM - 12:10 PM

Glenn F. Henriksen

Cloud wizard

With Blazor becoming an increasingly popular alternative, it's important to start off on the right foot. With applications that are thoroughly tested.

Being a UI framework, it's important to test more than just services and functions with unit testing, but also the UI behavior of your applications. Does the right thing happen when we click this button?

Being a component-based library it's also important to be aware of the impact you have when changing a component. Does it break the usage in other places? Does it unexpectedly change the output somewhere else?

The traditional way it to use a UI testing framework for this, but such tests can be complicated to write, are often brittle and rarely cover all your edge cases. In addition to being slow to run.

Instead, I want to show you how to do component-based testing. How you can verify the output, trigger events, control parameters, mock services and more. All using the open bUnit library on top of your regular unit-testing library like xUnit or NUnit. We'll go through some scenarios we encountered when testing our own Blazor components and show you how to get started with bUnit.

Web and Frontend

Get inspiration & news from us

I agree that Cornerstone will send me news via e-mail