Agent skill · affaan-m

fsharp-testing

F# testing patterns with xUnit, FsUnit, Unquote, FsCheck property-based testing, integration tests, and test organization best practices. Use when writing F# tests with xUnit, FsUnit, Unquote, or FsCheck.

What it needs

About 4k tokens when loaded.

What this skill does

F# Testing Patterns Comprehensive testing patterns for F# applications using xUnit, FsUnit, Unquote, FsCheck, and modern .NET testing practices. When to Activate Writing new tests for F# code Reviewing test quality and coverage Setting up test infrastructure for F# projects Debugging flaky or slow tests Test Framework Stack Tool Purpose --- --- xUnit Test framework (standard .NET ecosystem choice) FsUnit.xUnit F#-friendly assertion syntax for xUnit Unquote Assertion library using F# quotations for clear failure messages FsCheck.xUnit Property-based testing integrated with xUnit NSubstitute Mocking .NET dependencies Testcontainers Real infrastructure in integration tests WebApplicationFactory ASP.NET Core integration tests Unit Tests with xUnit + FsUnit Basic Test Structure Assertions with Unquote Unquote uses F# quotations so failure messages show the full expression that failed, not just "expected X got Y". Async Tests Parameterized Tests with Theory Property-Based Testing with FsCheck Using FsCheck.xUnit Custom Generators Mocking Dependencies Function Stubs (Preferred) NSubstitute for .NET Interfaces ASP.NET Core Integration Tests Test Organization Common Anti-Patterns Anti-Pattern Fix --- --- Testing implementation details Test behavior and outcomes Mutable shared test state Fresh state per test Thread.Sleep in async tests Use Task.Delay with timeout, or polling helpers Asserting on sprintf output Assert on typed values and pattern matches Ignoring CancellationToken Always pass and verify cancellation Skipping property-based tests Use FsCheck for any function with clear invariants Related Skills dotnet-patterns - Idiomatic .NET patterns, dependency injection, and architecture csharp-testing - C# testing patterns (shared infrastructure like WebApplicationFactory and Testcontainers applies to F# too) Running Tests

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills affaan-m/fsharp-testing--4393a2

View the source on GitHub

Browse the @skills marketplace