bUnit bUnit
Search Results for

    Show / Hide Table of Contents

    Getting started with bUnit

    To start writing tests for Blazor components, first set up a test project and then you can start adding tests.

    The basic getting started topics are as follows:

    1. Creating a new bUnit test project covers setting up a bUnit test project.
    2. Writing tests for Blazor components covers the basics of writing tests for Blazor components.

    The next level topics are:

    1. Providing different types of input to a component under test, e.g. passing parameters or injecting services.
    2. Verifying output in various ways from a component under test, e.g. inspecting the rendered markup.
    3. Mocking dependencies a component under test has, e.g. the IJsRuntime or HttpClient.

    Introduction video

    This video gives an introduction to bUnit, what it is, why its needed, and how to use it. It covers different testing strategies, and how to build maintainable test and maintainable components.

    Best practices unit testing Blazor components with bUnit - Egil Hansen - NDC Oslo 2021

    Getting help

    Can't figure out how to write a test for a testing scenario? Do you have a testing scenario that is hard to write or cannot be written elegantly with bUnit? Have you found a bug in bUnit? Head over to bUnit’s discussion forum to ask a question, give feedback, or suggest a new feature. Alternatively, join bUnits Gitter channel and let us know. There are no stupid questions - all are welcome!

    Premium sponsor: Progress Telerik.

    Editorial support provided by Packt.

    Supported by the .NET Foundation.

    • Improve this Doc
    Back to top Documentation updated on 03/10/2023 10:42:43 +00:00 in commit d48e4498d5.