package testo-util

  1. Overview
  2. Docs
Modules shared by testo, testo-lwt, etc

Install

dune-project
 Dependency

Authors

Maintainers

Sources

testo-0.3.4.tbz
sha256=50c4ad248a3234274c84f80b56d2c4007238c65cfd1e0a66b1952deaf04a4765
sha512=522c856350ea1cc3ca17cde59cbd50440ff36681952f672cfa0ba4451db41343a6de3ca0101f7d4465d30de3f337f226df289bbc21780f8a18a6d9a622e3fb55

Description

Testo is a test framework for OCaml.

Published: 18 Jan 2026

README

Testo CircleCI badge

image

Documentation: testocaml.net

Features

Testo is a test framework for OCaml that takes inspiration from its predecessor Alcotest and from pytest. Features include:

  • support for explicit XFAIL tests i.e. tests that are expected to fail, indicating that they should be fixed eventually;
  • support for test snapshots i.e. persistent storage of captured stdout, stderr, or output files;
  • reviewing and approving tests without re-running them;
  • nested test suites;
  • various ways to select tests;
  • parallel execution (using multiprocessing);
  • supports OCaml >= 4.08.

A test executable is generated from a list of tests written in OCaml. The function to interpret the command line and run things is Testo.interpret_argv. The core subcommands supported by a test executable are:

  • run: run tests
  • status: check the status of the tests without re-running them
  • approve: approve test output and make it the new reference

A test is fundamentally a name and test function of type unit -> unit. A test is considered successful if the test function returns normally and is considered failed if it raises an exception. A test is created with Testo.create which takes a variety of options in addition to the name and the test function.

For example, checking that some test result res equals an expected value of 42 is written as:

Testo.(check int) 42 res;

This raises an exception that is turned into a nice error message.

Dependencies (6)

  1. testo-diff = version
  2. ppx_deriving
  3. re >= "1.10.0"
  4. fpath
  5. ocaml >= "4.08.0"
  6. dune >= "3.18"

Dev Dependencies (1)

  1. odoc with-doc

Used by (2)

  1. testo >= "0.3.4"
  2. testo-lwt >= "0.3.4"

Conflicts

None