OUnit2 Quickstart with dune Build Status

html report

Setup

  1. install opam2

  2. install odoc and ounit2

    sh setup-opam
    

Build and run Test

method1: console output

dune runtest

Example output

> dune runtest test
dune runtest test
   test_list alias test/runtest
..
Ran: 2 tests in: 0.11 seconds.
OK

method2: HTML output

  1. set OUNIT_OUTPUT_HTML_DIR and run test
mkdir -p result
OUNIT_OUTPUT_HTML_DIR=result dune runtest
  1. HTML report will be saved as a file ./_build/default/test/result/index.html

Example Test Detail

2 kinds of tests

  • Test in a directory test
  • Inline test:
    • ppx_inline_test src
    • TODO qtest
    • TODO ppx_expect

TODO

  • measure code coverage with bisect_ppx
  • junit test report? (xml format)

References


Takashi Masuyama < mamewotoko@gmail.com >
https://mamewo.ddo.jp/