Behaviour driven development in OCaml



Could you please share your experience and technological stack for BDD. I’m interested in which testing frameworks/libraries you’re using, how you configure them and all BDD/testing-related best practices in OCaml community.


I had planned to hold off an announcement until a better time when I had more features. However, I and @Thegaram, who has been a great help, are working on which is progressing towards implementing Cucumber in OCaml. I would caution that we are still in very early stages but if you are interested in it, please head over to the repository and have a look.

Things we can already do:

  • Given, When, Then already work so there is a basic runtime.
  • Before and After hooks work.
  • State passing between steps by default

Things that are outstanding:

  • Tags do not work at the moment (the structures are there but we need to hook them up)
  • Running multiple feature files from the command line (we need to implement command line arguments but I am bouncing back and forth on using a getopt library or Cmdliner)
  • I am sure there are things that I am missing

I will be attending CukenFest in London later in the month and I will be doing the OSS hack day so I am hoping to get basic tags working then.


Thank you for your response. Cucumber is a good tool for end2end testing, however I’m more interested in tools like RSpec in Ruby which provides a BDD-tool for black box unit testing. Don’t you know testing solutions similar to RSpec?


Having looked at RSpec very quickly, it seems similar to Jasmine. Sadly, I do not know anything at this time in OCaml that is similar to RSpec. Although, I imagine that you could possibly build something similar based on OUnit.


There is ospec. Unfortunately, it is not actively developed anymore.