FsSpec: Introducing yet another Unit Testing/BDD framework for F#

Despite of a fact that we already have number of frameworks for unit testing for F#, let me introduce another one.

Source code of the FsSpec is hosted on GitHub, you can donwload zip

Syntax

Syntax is inspired by RSpec, so specification looks like:

do describe "Calculator" [        

    it "should add two integers" (fun unit -> 

        let res = Calc.Add 2 2
        res.should_be_equal_to 4
    );


    it "should devide two integers" (fun unit -> 

        let res = Calc.Div 2 2
        res.should_be_equal_to 1
    );

]

Looks pretty well, isn’t it? Unfortunately, I have number of problems that I have to solve to make this stuff usable. First of all is shared initialization of the specifications. Now you can do this just before specification (describe statement) but this looks bit ugly. Second are assertions. Now they are implemented as extension methods and look less readable than RSpec’s assertions.

Implementation

Well, it about 46 lines of code… Not too much to discuss. Better to visit repository on GitHub.