Bisect_ppx – OCaml code coverage with nice HTML reports

Bisect_ppx is the OCaml code coverage tool. Depend on it like any other PPX, then run your test suite. Each file gets a coverage report:



This gives a pretty decent sense of the gaps in your testing. It’s especially helpful when working with multiple contributors.

For a live example, see the report Bisect_ppx generates for itself.


Usage is pretty simple. There are instructions for ocamlfind, Ocamlbuild, OASIS, and Jbuilder. It basically consists of:

  1. making your source files depend on the bisect_ppx package,
  2. running your test suite, and
  3. passing the resulting raw coverage statistics through Bisect_ppx’s report tool.

ocveralls by Julien Sagot submits Bisect_ppx reports to coveralls.io.


This announcement is prompted by the recent release of Bisect_ppx 1.3.0, which is a good opportunity to introduce the tool to Discourse :slight_smile:

Bisect_ppx has actually been out for several years. It is in use by Lwt, ctypes, Oml, and Markup.ml, among other projects. It was originally Bisect, by Xavier Clerc.


Happy testing!


9 Likes

The gif is still using ocamlbuild :wink:

2 Likes

We’ll be making a new one later :slight_smile: You can open an issue :stuck_out_tongue:

Any chance of renaming to something like coverage_ppx? Bisect_ppx gave me the completely wrong idea about the project.

1 Like

Yeah, I also found it strange when I first found the project. I don’t know how practical changing the name is at this point, but I opened an issue about it for any discussion.

1 Like

Excellent! Thanks Anton! Also, FWIW, I’m also in favor of changing its name to coverage_ppx.

2 Likes

@rdavison for the record, Bisect_ppx is currently maintained by myself and Leonid Rozenberg (@leonidr).

1 Like

My apologies, thanks for the correction Anton, and thanks to all involved

1 Like