package tezt
Install
    
    dune-project
 Dependency
Authors
Maintainers
Sources
md5=15abf8d74a268d18dd42e539f894fbe8
    
    
  sha512=fb30fc561a1e77f037a4ce7eb022345ef0620fa1ac3e16bd83b7f867ef3d0c0ff676255a967d3122e7ef25b22f4b0dc01fba9fe90fe1b486e68b268ba1e9a9c9
    
    
  Description
Published: 31 Oct 2025
README
Tezt
Tezt (pronounced "tezty", as in "tasty" with a "z") is a test framework for OCaml. It is well suited for writing and executing unit, integration and regression tests. It integrates well with continuous integration (CI).
Documentation
The documentation contains:
- the API, which includes an introduction to Tezt as well as documentation for all modules;
- the default --help, which includes how to select tests from the command-line.
Getting Started
Install
Install with opam:
opam install teztWrite a Test
Create a file such as test/main.ml:
(* [Tezt] and its submodule [Base] are designed to be opened.
   [Tezt] is the main module of the library and it only contains submodules,
   such as [Test] which is used below.
   [Tezt.Base] contains values such as [unit] which is used below. *)
open Tezt
open Tezt.Base
(* Register as many tests as you want like this. *)
let () =
  Test.register
    (* [~__FILE__] contains the name of the file in which the test is defined.
       It allows to select tests to run based on their filename. *)
    ~__FILE__
    (* Titles uniquely identify tests so that they can be individually selected. *)
    ~title: "demo"
    (* Tags are another way to group tests together to select them. *)
    ~tags: [ "math"; "addition" ]
  @@ fun () ->
  (* Here is the actual test. *)
  if 1 + 1 <> 2 then Test.fail "expected 1 + 1 = 2, got %d" (1 + 1);
  (* Here is another way to write the same test. *)
  Check.((1 + 1 = 2) int) ~error_msg: "expected 1 + 1 = %R, got %L";
  Log.info "Math is safe today.";
  (* [unit] is [Lwt.return ()]. *)
  unit
(* Call the main function of Tezt so that it actually runs your tests. *)
let () = Test.run ()Then create a test/dune file:
(test (name main) (libraries tezt))You can now run your test with dune runtest. However dune runtest is limited because you cannot pass command-line arguments. Usually, you would instead run something like:
dune exec test/main.exe -- -iThis should show you:
[09:04:06.395] Math is safe today.
[09:04:06.395] [SUCCESS] (1/1) demoThe -i flag is a short-hand for --info and sets the log level so that you can see the result of the call to Log.info.
To see the list of command-line options, in particular how to select tests from the command-line, how to run them in parallel and how to produce reports, run:
dune exec test/main.exe -- --helpor just look them up in the documentation.
Dependencies (7)
Dev Dependencies (4)
- 
  
    ocamlformat
  
  
    with-test & = "0.27.0"
- 
  
    js_of_ocaml-lwt
  
  
    with-test
- 
  
    js_of_ocaml
  
  
    with-test
- 
  
    conf-npm
  
  
    with-test
Used by (70)
- bam
- 
  
    bls12-381
  
  
    = "18.0" | >= "19.0"
- catala-lsp
- 
  
    dedukti
  
  
    >= "2.7"
- MlFront_Cache
- 
  
    MlFront_Cli
  
  
    < "2.3.1"
- MlFront_Codept
- MlFront_Config
- MlFront_Core
- MlFront_Errors
- MlFront_Exec
- MlFront_Manip
- MlFront_Signify
- MlFront_Thunk
- MlFront_ZipFile
- 
  
    octez-alcotezt
  
  
    != "18.1"
- octez-bls12-381-polynomial
- 
  
    octez-l2-libs
  
  
    != "18.1"
- 
  
    octez-libs
  
  
    != "18.1"
- octez-mec
- octez-polynomial
- 
  
    octez-proto-libs
  
  
    != "18.1"
- 
  
    octez-protocol-017-PtNairob-libs
  
  
    != "18.1" & < "20.1"
- 
  
    octez-protocol-018-Proxford-libs
  
  
    != "18.1"
- octez-protocol-019-PtParisB-libs
- octez-protocol-020-PsParisC-libs
- 
  
    octez-protocol-alpha-libs
  
  
    != "18.1"
- 
  
    octez-shell-libs
  
  
    >= "19.0"
- octez-smart-rollup-wasm-benchmark-lib
- SourceCode_ASCII
- 
  
    tezos-baking-016-PtMumbai
  
  
    >= "17.3"
- tezos-baking-017-PtNairob
- 
  
    tezos-baking-alpha
  
  
    >= "17.3"
- 
  
    tezos-base
  
  
    >= "17.3"
- 
  
    tezos-clic
  
  
    >= "17.3"
- 
  
    tezos-client-016-PtMumbai
  
  
    >= "17.3"
- tezos-client-017-PtNairob
- 
  
    tezos-client-alpha
  
  
    >= "17.3"
- 
  
    tezos-client-base
  
  
    >= "17.3"
- 
  
    tezos-client-base-unix
  
  
    >= "17.3"
- 
  
    tezos-context
  
  
    >= "17.3"
- 
  
    tezos-crypto
  
  
    >= "17.3"
- 
  
    tezos-crypto-dal
  
  
    >= "17.3"
- 
  
    tezos-error-monad
  
  
    >= "17.3"
- 
  
    tezos-hacl
  
  
    >= "17.3"
- 
  
    tezos-layer2-store
  
  
    >= "17.3"
- 
  
    tezos-lwt-result-stdlib
  
  
    >= "17.3"
- 
  
    tezos-mockup
  
  
    >= "17.3"
- tezos-openapi
- 
  
    tezos-p2p
  
  
    >= "17.3"
- 
  
    tezos-protocol-environment
  
  
    >= "17.3"
- 
  
    tezos-proxy
  
  
    >= "17.3"
- 
  
    tezos-proxy-server-config
  
  
    >= "17.3" & != "18.1"
- 
  
    tezos-requester
  
  
    >= "17.3"
- 
  
    tezos-rpc-http-server
  
  
    >= "17.3"
- 
  
    tezos-sapling
  
  
    >= "17.3"
- 
  
    tezos-scoru-wasm-helpers
  
  
    < "17.3"
- 
  
    tezos-shell
  
  
    >= "17.3"
- 
  
    tezos-shell-services
  
  
    >= "17.3"
- 
  
    tezos-signer-backends
  
  
    >= "17.3"
- 
  
    tezos-stdlib
  
  
    >= "17.3"
- 
  
    tezos-stdlib-unix
  
  
    >= "17.3"
- 
  
    tezos-store
  
  
    >= "17.3"
- 
  
    tezos-version
  
  
    >= "17.3"
- 
  
    tezos-webassembly-interpreter
  
  
    >= "17.3"
- 
  
    tezos-workers
  
  
    >= "17.3"
- tezt-bam
- tezt-performance-regression
- 
  
    tezt-tezos
  
  
    != "18.1"
- universo
Conflicts (2)
- 
  
    js_of_ocaml-lwt
  
  
    < "4.0.0"
- 
  
    js_of_ocaml
  
  
    < "4.0.0"