# bUnit-dev/bUnit

bUnit is a testing library for Blazor components that make tests look, feel, and runs like regular unit tests. bUnit makes it easy to render and control a component under test’s life-cycle, pass parameter and inject services into it, trigger event handlers, and verify the rendered markup from the component using a built-in semantic HTML comparer.

Repository: https://github.com/bUnit-dev/bUnit
Canonical: https://ross.abutalabs.com/products/bunit
Homepage: https://bunit.dev
Language: C#
License: MIT
License Family: permissive
Topics: razor-components, unit-testing, blazor, blazor-components, xunit, nunit, mstest, component-testing, hacktoberfest, bunit, snapshot-testing, trigger-event-handlers, nuget, cascading-values
Last push: 2026-08-17T17:57:30+00:00

## Health v2 (maintenance only)
Score: 98/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 98, release rhythm 96, longevity 100
- inputs: {"age_days": 2594, "days_push": 16, "days_rel": 30, "gap_med": 18.5, "n_releases_24m": 19}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1304, forks 121 (observed 2026-08-28T04:04:18.548994+00:00)

## What it is
bUnit is a C# testing library for Blazor components that lets tests run like regular unit tests on top of xUnit, NUnit, MSTest, and TUnit. It supports rendering components, passing parameters and injecting services, triggering event handlers, mocking dependencies like IJSRuntime, and verifying output with a semantic HTML comparer.

## Use cases
- unit test blazor components
- render a razor component in a test and verify its markup
- trigger button click events in blazor component tests
- mock ijsruntime in blazor tests
- test blazor component with injected services and cascading values
- fast component tests without a browser
- snapshot test blazor component output

## When to choose
- you write Blazor apps and want fast, millisecond component tests without a browser
- you already use xUnit, NUnit, MSTest, or TUnit and want component tests in the same suite
- you need to test component lifecycle, parameters, event handlers, and rendered markup

## When to avoid
- you need full end-to-end browser testing of a running Blazor app - use Playwright or similar
- you are not working with Blazor or Razor components
- you need visual regression testing of actual rendered pixels

## Facets
- artifact type: library
- maturity: active
- function: testing, mocking, ui-components
- domain: testing, web-development, frontend, developer-tools
- platform: dotnet, cross-platform
- tags: blazor, razor-components, component-testing, xunit, nunit, mstest, snapshot-testing, semantic-html-comparer, csharp

## Member repositories
- bUnit-dev/bUnit (main) score 98

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:18.548994+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T04:51:06.486845+00:00, confidence not recorded.
  - readme: https://github.com/bUnit-dev/bUnit (fetched 2026-08-28T04:04:18.548994+00:00, sha 5d1a418858cd)
  - homepage: https://bunit.dev (fetched 2026-08-29T12:09:02.683570+00:00, sha 5e15bfaf6c9b)
  - site_page: https://bunit.dev/docs/getting-started/index.html (fetched 2026-08-29T12:09:02.711356+00:00, sha b2bf2636b887)
  - site_page: https://bunit.dev/docs/external-resources.html (fetched 2026-08-29T12:09:02.713198+00:00, sha b1e2f3b13b5b)
- Data as of 2026-08-30T08:39:29.467469+00:00.
