Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[ANN] OSpec 0.2.0 - BDD for OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Andre Nathan <andre@d...>
Subject: [ANN] OSpec 0.2.0 - BDD for OCaml

I'm happy to announce a new version of OSpec, a Behavior-Driven Development
tool for OCaml using a Camlp4 syntax extension. You can download this release
from the ocamlcore forge at

or directly clone the repository from Github:

== New features:

* Nested specifications: it is now possible to group related examples in a
nested "describe" block. For example,

  describe "Person" do
    describe "name" do
      it "should not be empty" do
        (String.length should be > 0
      it "should only contain valid characters" do
        ( should match_regexp "^[A-Za-z- ]+$"

* Property testing (inspired by QuickCheck): OSpec can now autogenerate
test cases with the "forall" keyword. For example,

  describe "A list" do
    it "should equal itself when reversed twice" do
      forall list l . (List.rev (List.rev l)) should = l

This will generate lists of random length and test each one against the
specified property.

There are 28 predefined random sample generators for the basic OCaml
types which can be used directly in tests or as building blocks for
custom generators.

* Better error handling: exceptions in the specifications are now caught
and reported.

== Bug fixes:

* Properly count pending examples.

OSpec is released under the MIT license. Please see the README file in the
distribution for more details and examples.

Best regards,