Announcing Cucumber.ml 1.0.0

Today I would like to announce the 1.0.0 release of Cucumber.ml, which brings Behaviour Driven Development to the OCaml programming language. Before I start though, I would like to thank Thegaram for his contributions and feedback to this.

OCaml

For those of you who are not familiar with the OCaml language, it is a
multi-paradigm, strongly, structural and, inferred typed language of the ML family of languages which is generally used for its functional properties and strong module system. Companies which use it include Facebook, who created the ReasonML language, which is a thin wrapper around OCaml, and Jane Street Capital, who use it for market making in the financial markets. I would highly recommend having a look.

Why?

While many of OCaml's language features tend to reduce the need for testing in general, I still feel that communicating between stakeholders and programmers is important and Cucumber is well-placed to help in that. Additionally, I felt that this was a good way for me to contribute to the OCaml ecosystem in a positive way.

Installing

There are a few complications when working with Cucumber.ml. The first and the most important is that Cucumber.ml delegates its Gherkin parsing to the gherkin-c implementation using OCaml's foreign function interface. This means that, before you can use Cucumber.ml, you will need to compile and install the gherkin-c as a shared library on your system. On Linux, this means you will need to install libgherkin.so in /usr/lib and copy the gherkin-c header files into /usr/include/gherkin.

Cucumber.ml uses the Dune build system for OCaml. You will need to have this installed before you can build Cucumber.ml. Unfortunately, I have not yet added Cucumber.ml to the Opam package manager. If anyone would like to help me do that, I would be very grateful.

Once you have checked out the code and have the above prerequisites installed, all you need to do is:

dune build && dune install

which will install the cucumber package into your local Opam repository. From there you can write your step definitions in OCaml and run your feature files against them. For more information on how to use Cucumber.ml, please see the Cucumber.ml README file on the repository.

One of the more unusual aspects of Cucumber.ml is that it assumes that once you start executing your step definitions that it will control the command line arguments. This can be surprising so please be aware of it. Basically, the executable created by the compilation process is the cucumber runner and it is that executable which will run your step definitions.