BA

backend-testing

Assists with writing robust backend integration tests using xUnit, FluentClient, and AppWebHostFactory in .NET.

Install

mkdir -p .claude/skills/backend-testing && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/1901" && unzip -o skill.zip -d .claude/skills/backend-testing && rm skill.zip

Installs to .claude/skills/backend-testing

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Use this skill when writing or modifying C# tests — unit tests, integration tests, or test fixtures. Covers xUnit patterns, AppWebHostFactory for integration testing, FluentClient for API assertions, ProxyTimeProvider for time manipulation, and test data builders. Apply when adding new test cases, debugging test failures, or setting up test infrastructure.
358 chars✓ has a “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)
Intermediate

Key capabilities

  • →Write integration tests with AppWebHostFactory
  • →Simulate time-dependent logic with ProxyTimeProvider
  • →Generate test data using automated builders
  • →Perform API assertions with FluentClient

How it works

Tests inherit from base classes like IntegrationTestsBase to access DI services, fluent HTTP clients, and time manipulation utilities.

Inputs & outputs

You give it
Test scenario parameters
You get back
Test assertion results

When to use backend-testing

  • →Write integration tests using AppWebHostFactory
  • →Generate test data with automated builders
  • →Simulate time-dependent logic in tests
  • →Implement xUnit tests for backend services

About this skill

Backend Testing

Unit test structure

Follow Microsoft's .NET unit testing best practices.

Organize tests as Arrange–Act–Assert:

  • Arrange: create the subject, minimal input, and required dependencies.
  • Act: perform the behavior under test, awaiting asynchronous work.
  • Assert: check the observable result and relevant side effects. Keep assertions separate from the action.

Keep unit tests fast, isolated, repeatable, and self-checking. Use clear names and minimal setup; test behavior rather than implementation details. Avoid branching or recreating production logic to calculate expected results. Before adding a test, identify the distinct regression it catches and inspect existing coverage. Extend an existing scenario or parameterize equivalent cases instead of duplicating setup. Combine assertions for the same behavior when they share expensive setup, while keeping independent behaviors separately diagnosable. Do not add trivial accessor, framework, or implementation-mirroring tests. Infrastructure-dependent checks belong in integration tests, using the fixtures below. Coverage percentages and test counts alone do not establish test quality.

Use the smallest fixture that proves the behavior. For batching/pagination, cross the real boundary rather than generating arbitrary thousands of records. Keep benchmarks out of the correctness suite. Inspect CI timing reports for expensive tests and preserve automatic shard discovery when restructuring test classes.

Fixtures and locations

Under tests/Exceptionless.Tests/:

  • IntegrationTestsBase.cs and AppWebHostFactory.cs: HTTP/service integration fixtures.
  • TestWithServices.cs: tests needing dependency injection.
  • Api/Endpoints/, Api/Filters/, Api/Handlers/, and Api/Results/: API tests by boundary.
  • Utility/AppSendBuilder.cs: fluent HTTP requests and assertions.
  • Utility/DataBuilder.cs: synthetic records.
  • Utility/ProxyTimeProvider.cs: controlled time.

Name tests MethodUnderTest_Scenario_ExpectedBehavior.

HTTP and state

Use SendRequestAsync with AppSendBuilder and its authorization helpers: AsGlobalAdminUser, AsTestOrganizationUser, AsFreeOrganizationUser, and AsTestOrganizationClientUser. Match an existing endpoint test for the expected response and fixture setup.

Use CreateDataAsync for synthetic data and RefreshDataAsync after database writes when reads require index refresh. ResetDataAsync clears the integration fixture's data; never point these fixtures at production.

Tests use the production serializer. For JSON compatibility, inspect Serializer/ and the relevant API snapshots.

Time

Use the fixture's TimeProvider: Advance, SetUtcNow, and Restore. Prefer controlled time to real waits.

Follow root guidance for focused commands, conditional Aspire startup, and API contract verification.

When not to use it

  • →When testing non-backend C# components

Prerequisites

xUnitFoundatio.Xunit

Limitations

  • →Requires .NET 8+ for TimeProvider usage

How it compares

It uses a standardized naming convention and specific base classes to ensure consistent test structure compared to ad-hoc xUnit implementations.

Compared to similar skills

backend-testing side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
backend-testing (this skill)32moNo flagsIntermediate
csharp-pro95moNo flagsIntermediate
csharp-developer434moNo flagsAdvanced
performance-benchmark36moNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

csharp-pro

sickn33

Write modern C# code with advanced features like records, pattern matching, and async/await. Optimizes .NET applications, implements enterprise patterns, and ensures comprehensive testing. Use PROACTIVELY for C# refactoring, performance optimization, or complex .NET solutions.

953

csharp-developer

zenobi-us

Expert C# developer specializing in modern .NET development, ASP.NET Core, and cloud-native applications. Masters C# 12 features, Blazor, and cross-platform development with emphasis on performance and clean architecture.

43151

performance-benchmark

dotnet

Generate and run ad hoc performance benchmarks to validate code changes. Use this when asked to benchmark, profile, or validate the performance impact of a code change in dotnet/runtime.

328

dotnet-backend-patterns

wshobson

Master C#/.NET backend development patterns for building robust APIs, MCP servers, and enterprise applications. Covers async/await, dependency injection, Entity Framework Core, Dapper, configuration, caching, and testing with xUnit. Use when developing .NET backends, reviewing C# code, or designing API architectures.

722

azure-servicebus-dotnet

microsoft

Azure Service Bus SDK for .NET. Enterprise messaging with queues, topics, subscriptions, and sessions. Use for reliable message delivery, pub/sub patterns, dead letter handling, and background processing. Triggers: "Service Bus", "ServiceBusClient", "ServiceBusSender", "ServiceBusReceiver", "ServiceBusProcessor", "message queue", "pub/sub .NET", "dead letter queue".

316

azure-identity-dotnet

microsoft

Azure Identity SDK for .NET. Authentication library for Azure SDK clients using Microsoft Entra ID. Use for DefaultAzureCredential, managed identity, service principals, and developer credentials. Triggers: "Azure Identity", "DefaultAzureCredential", "ManagedIdentityCredential", "ClientSecretCredential", "authentication .NET", "Azure auth", "credential chain".

13

Search skills

Search the agent skills registry