Claude Code Plugins

Community-maintained marketplace

Feedback

Blazor component testing with bUnit. Use when writing unit tests for Blazor components, testing user interactions, mocking services/dependencies, testing MudBlazor components, testing components with Neatoo domain objects, or debugging component rendering issues.

Install Skill

1Download skill
2Enable skills in Claude

Open claude.ai/settings/capabilities and find the "Skills" section

3Upload to Claude

Click "Upload skill" and select the downloaded ZIP file

Note: Please verify skill by going through its instructions before using it.

SKILL.md

name bunit
description Blazor component testing with bUnit. Use when writing unit tests for Blazor components, testing user interactions, mocking services/dependencies, testing MudBlazor components, testing components with Neatoo domain objects, or debugging component rendering issues.
allowed-tools Read, Write, Edit, Glob, Grep, Bash(dotnet:*), WebFetch

bUnit - Blazor Component Testing

Overview

bUnit is a testing library for Blazor components that enables testing without a browser. It provides:

  • Component rendering in a test environment
  • DOM assertions and markup verification
  • User interaction simulation (clicks, inputs, form submissions)
  • Service mocking and dependency injection
  • Async testing with waiting utilities
  • Blazor lifecycle testing

Installation

# Add bUnit with xUnit support
dotnet add package bunit

# Or individual packages
dotnet add package bunit.core
dotnet add package bunit.web
dotnet add package bunit.xunit   # For xUnit integration

Quick Start

Basic Component Test

public class CounterTests : TestContext
{
    [Fact]
    public void Counter_InitialCount_IsZero()
    {
        // Arrange & Act
        var cut = RenderComponent<Counter>();

        // Assert
        cut.Find("p").MarkupMatches("<p>Current count: 0</p>");
    }

    [Fact]
    public void Counter_ClickButton_IncrementsCount()
    {
        // Arrange
        var cut = RenderComponent<Counter>();

        // Act
        cut.Find("button").Click();

        // Assert
        cut.Find("p").MarkupMatches("<p>Current count: 1</p>");
    }
}

Additional Resources

For detailed guidance, see:

Official Documentation