fsharp-tests

Generate Expecto-based tests for F# applications across src/Tests/ projects.

1|Updated Nov 26, 2025
One-click install
npx skills add https://github.com/heimeshoff/Cinemarco --skill fsharp-tests
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fsharp-tests
Source: https://github.com/heimeshoff/Cinemarco/tree/main/.claude/skills/fsharp-tests
Command: npx skills add https://github.com/heimeshoff/Cinemarco --skill fsharp-tests

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill guides you in writing comprehensive tests for F# apps using Expecto, enabling reliable, maintainable code across domain logic, validation, persistence, API contracts, and frontend state tests.

Core Features & Use Cases

  • Domain Tests: Validate domain pure functions.
  • Validation Tests: Ensure boundary rules.
  • Persistence Tests: Async DB or file-based tests.
  • UI/State Tests: Elmish state transitions and frontend patterns.

Quick Start

Run the tests with dotnet test in the solution and use provided test projects to expand coverage.

Frequently Asked Questions about fsharp-tests

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write unit tests for F# with Expecto?

Unit tests with Expecto validate individual F# functions by asserting expected outputs. Create test files in your Tests project, use `testCase` or `testList` to organize tests, and run `dotnet test` to execute them across domain logic, validation rules, and persistence operations.

Can I use property-based testing with Expecto?

Yes. Expecto.FsCheck integrates property-based testing into Expecto, generating random inputs to verify your F# functions hold invariants across many cases. Use `testProperty` to define property tests alongside unit tests in the same test project.

How do I test async operations and API contracts in F#?

Expecto supports async tests via `testAsync` and `asyncTest` for database queries, file I/O, and HTTP endpoints. Structure tests in DomainTests.fs, ValidationTests.fs, and dedicated API contract files, then run with `dotnet test` to validate async state transitions and external dependencies.

What project structure do I need for Expecto testing?

Set up an Sdk-style net8.0 test project with packages Expecto and Expecto.FsCheck, plus project references to your Server and Shared projects. Organize test files—DomainTests.fs, ValidationTests.fs, Program.fs—under src/Tests/ to mirror your application's domain layers.

Do I need Expecto to test Elmish state transitions?

Expecto enables UI and state tests for Elmish frontend patterns by testing state transitions, message handlers, and view logic. Write tests in your Tests project with references to Client projects to validate state integrity across user interactions.

What's the difference between unit tests and property tests in Expecto?

Unit tests verify specific inputs and outputs for known cases; property tests generate random inputs to check invariants hold universally. Use `testCase` for deterministic scenarios and `testProperty` with Expecto.FsCheck for broader coverage of edge cases and boundary rules.