What does this skill do?

The Advanced Testing in F# Skill provides a structured guide for implementing unit, property, and integration tests in F# applications. It combines xUnit as the base framework, FsUnit for idiomatic syntax, Unquote for clear error messages, and FsCheck for property-based testing, covering the entire modern .NET testing ecosystem.

Unit Tests with FsUnit
Write language tests in F# using `should equal` and `Unquote` to verify invariants with descriptive error messages.
Property-Based Testing
Verifica invariantes con FsCheck y [<Property>] ejecutando cientos de casos generados aleatoriamente en lugar de ejemplos aislados.
Asynchronous Testing with Stubs
Manage internal dependencies using function stubs and test asynchronous workflows without coupling to specific implementations.
Integration with ASP.NET Core
Use WebApplicationFactory and Testcontainers to test real APIs with in-memory databases or ephemeral infrastructure.

Usage examples

🧪 Unit test
Write a unit test using FsUnit and Unquote for the Order.calculateTotal function that verifies that the total is the sum of the item prices.
📐 Property testing
Create a property test using FsCheck that verifies that the total of an order is always non-negative.
⚡ Asynchronous test
Generate an asynchronous test using function stubs for `OrderService.placeOrder` that verifies that the confirmed order is saved.
🌐 API Integration
Write an integration test using WebApplicationFactory for the GET /api/orders endpoint that returns a 404 error when the order cannot be found.

Features

Stack xUnit + FsUnit + Unquote A base framework with idiomatic F# syntax and error messages based on quotations for quick diagnostics.
Property-Based Testing with FsCheck Verifica invariantes ejecutando cientos de casos generados aleatoriamente con [<Property>] y reporte de contraejemplos.
Dependency Management It prefers function stubs for internal dependencies and NSubstitute for standard .NET interfaces.
Integration Tests WebApplicationFactory for ASP.NET Core APIs and Testcontainers for real, ephemeral infrastructure.
Execution and Filtering `dotnet test` with filters by name or project, and `dotnet watch test` for hot reload.

Frequently asked questions

It uses xUnit as its base framework, FsUnit for idiomatic syntax in F#, Unquote for expressive error messages, and FsCheck for property-based testing.
Yes. You need the xUnit, FsUnit.Xunit, Unquote, and FsCheck.Xunit packages in your F# test project.
Sí. La skill incluye patrones para pruebas de integración usando WebApplicationFactory<Program> y Testcontainers para infraestructura real.
Use `dotnet test` for normal execution, applying filters by name or project. During development, you can use `dotnet watch test` for hot reloading.
Advanced Testing in F# — Testing Patterns with Claude AI

¿Prefieres escuchar el contenido? Genera la narración de audio con un clic.