Forrest logo
back to the dune tool

dune:tldr:a1f10

dune: Run all tests.
$ dune runtest
try on your machine

The command dune runtest is a command used in the Dune build system to run the tests of a project.

Dune is a powerful build system for OCaml and Reason projects. It simplifies the build configuration process by automating many common tasks, such as dependency management, building, and testing.

When you run dune runtest, Dune will locate the test files within your project directory based on the project's build configuration file (dune) and execute those tests.

Here's a step-by-step breakdown of what happens when you run dune runtest:

  1. Dune reads the dune-project file to determine the root of the project.
  2. Dune looks for a dune file in the project's root directory, which contains the build configuration.
  3. The dune file specifies the test executables or libraries that need to be built for testing.
  4. Dune compiles the necessary test files (if required) and links them with the necessary code.
  5. Dune runs the compiled test executables or libraries.
  6. The test executables or libraries perform the defined tests.
  7. Dune collects and reports the test results.

The output of dune runtest typically includes a summary of the tests executed, which ones passed, failed, or were skipped, and any relevant error messages or stack traces.

Running tests with dune runtest ensures that your project remains functional and that any changes you make to the code do not introduce bugs or regressions. It helps maintain the reliability and stability of your project.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the dune tool