Overview
Explore best practices for unit testing Blazor components using bUnit in this NDC Oslo 2021 conference talk. Learn why UI component tests are not inherently brittle, slow, or hard to maintain when using bUnit, a testing library designed to make Blazor component testing feel like testing plain old C# objects. Discover how to write stable and maintainable test suites while improving the maintainability of your Blazor components. Dive into topics such as the Counter component, functionality testing, semantic markup verification, creating testable components, and isolating components under test. Gain insights on using substitute components, mocking, and the built-in Stub component to enhance your testing approach.
Syllabus
Intro
What is bonit?
The Counter component
Test of component
Running Unit tests
Functionality testing - configure pizza dialog
To verifying markup, do it semantically!
Semantically verifying markup
Semantic verification modifiers
Creating testable and maintainable components
Dynamic component example
Creating maintainable tests
Summary -testing
Isolating the component under test
Rules for substitute components
Substitution with the built-in Stub component
Mocking components
Taught by
NDC Conferences