A lightweight and colorful test framework for OCaml with quiet output and expressive test selection.
Alcotest is a unit testing framework for OCaml that provides a simple, minimal API for writing and running tests. It focuses on delivering a clean, colorful output where only failing tests are fully displayed with logs, making it easier to identify and debug issues without console noise.
OCaml developers and teams writing unit tests for libraries or applications, particularly those who value clear, focused test output and a straightforward API.
Developers choose Alcotest for its colorful, quiet output that highlights failures, its expressive test selection using regular expressions and ranges, and its simple yet flexible API with support for custom arguments and Lwt integration for asynchronous tests.
A lightweight and colourful test framework
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Only fully displays logs for failing tests, reducing console noise and making failures easy to spot, as shown in the README's error screenshot where only faulty runs are detailed.
Supports filtering tests using regular expressions and number ranges (e.g., '1..3'), allowing precise control over test execution via a simple query language demonstrated in the examples.
Provides Alcotest_lwt for asynchronous tests with proper resource cleanup using switches and async exception handling, preventing process crashes as illustrated in the Lwt example.
Exposes a straightforward TESTABLE module and check function, making it easy to write and run tests without unnecessary complexity, evident in the concise code examples like simple.ml.
Lacks support for property-based testing; developers must use separate libraries like qcheck or crowbar for random generation and QuickCheck-style tests, as admitted in the comparison section.
Cannot filter tests by individual test case names (e.g., 'Lower case'), only by test suite names and numbers, which the README notes as a limitation for precise selection.
Requires integration with Cmdliner to pass command-line arguments to tests, adding an external dependency and complexity for parameterized testing, as shown in the custom options example.