ocaml-testing

Structure OCaml test suites with Alcotest, Eio, and Dune conventions.

35|9|Updated Dec 25, 2025
One-click install
npx skills add https://github.com/avsm/ocaml-claude-marketplace --skill ocaml-testing-avsm
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ocaml-testing
Source: https://github.com/avsm/ocaml-claude-marketplace/tree/main/plugins/ocaml-dev/skills/ocaml-testing
Command: npx skills add https://github.com/avsm/ocaml-claude-marketplace --skill ocaml-testing-avsm

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

OCaml projects often struggle with consistent, scalable testing practices. This skill provides structured guidelines for unit tests, test organization, and mock-based testing to improve reliability and maintainability.

Core Features & Use Cases

  • Unit Test First: Emphasizes unit tests for modules and a 1:1 mapping of lib/.ml to test/test_.ml.
  • Isolated, Descriptive Tests: Each test is independent with clear naming.
  • Dune/Eio/Alcotest Guidance: Provides examples and conventions for integrating Alcotest, Eio mocks, and cram tests within a Dune workflow.
  • Use Case: Adopt these patterns to ensure scalable test suites as your OCaml project grows from library to application.

Quick Start

Use this skill to structure your OCaml project's test suite according to the provided conventions and example patterns.

Frequently Asked Questions about ocaml-testing

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

FAQPage Schema
How do I structure unit tests in an OCaml project using Dune?

Organize OCaml unit tests by maintaining a 1:1 mapping between lib/*.ml modules and test/test_*.ml files, keeping each test isolated and descriptively named within your Dune workflow.

What is the best way to write isolated and descriptive tests in OCaml?

Write isolated OCaml tests by ensuring each test runs independently without hidden state dependencies. Use clear, descriptive naming conventions for test functions and test suites to improve long-term maintainability.

Does Alcotest work with Eio for mock-based testing in OCaml?

Yes, Alcotest integrates with Eio for mock-based testing in OCaml projects. You can use Eio mocks within your Alcotest test suites to simulate effects and isolate unit tests from external dependencies.

Can I use cram tests within a Dune workflow for OCaml libraries?

Yes, you can use cram tests within a Dune workflow to verify OCaml library command-line behavior. Cram tests complement unit tests by capturing executable output and ensuring CLI interfaces remain stable.

When should I apply test-driven development patterns to an OCaml project?

Apply test-driven development to OCaml projects when transitioning a library to an application, ensuring scalable test suites. Adopt structured unit test patterns early to maintain reliability as module complexity increases.

Why do my OCaml test suites become hard to maintain as the project grows?

OCaml test suites become hard to maintain without structured organization, consistent naming, and isolated tests. Adopting a 1:1 lib-to-test mapping and mock-based patterns prevents state coupling and ensures reliability.