Getting Started with bUnit
To start writing tests for Blazor components, first set up a test project and then you can start adding tests, using either using C# or Razor syntax.
The basic getting started topics are:
- Creating a new bUnit Test Project covers setting up a bUnit test project.
- Writing Tests in C# for Blazor Components covers the basics of writing tests in C#, i.e. like regular unit tests.
- Writing Tests in Razor Syntax for Blazor Components covers the basics of writing tests in
.razorfiles using Razor and C# syntax.
The next level topics are:
- Providing different types of input to a component under test in C# based tests, e.g. passing parameters or injecting services.
- Verifying output in various ways from a component under test, e.g. inspecting the rendered markup.
- Mocking dependencies a component under test has, e.g. the
If you cannot figure out how to write a test for a testing scenario? If you have a testing scenario that is hard to write or it cannot be written elegantly with bUnit? If you found a bug in bUnit? Head over to GitHub issues list to ask a question, suggest a new feature, or join bUnits Gitter channel and let us know. There are no stupid questions, all questions are welcome!