Developing on Staxmanade

NuGet Project Uncovered: NaturalSpec

If you are coming to this series of posts for the first time you might check out my introductory post for a little context.

NaturalSpec is a BDD framework written in F#. This one is interesting due to F#’s concise nature and can give you very readable tests/specs.

The below sample was pulled from the github readme.

let ``When removing an element from a list it should not contain the element``() =
Given [1;2;3;4;5] // "Arrange" test context
|> When removing 3 // "Act"
|> It shouldn't contain 3 // "Assert"
|> It should contain 4 // another assertion
|> It should have (length 4) // Assertion for length
|> It shouldn't have duplicates // Tests if the context contains duplicates
|> Verify // Verify scenario

It says you don’t have to learn F# to use it. Which I’d argue you may not have to learn F# as deep as you might to be able to code a production product in it, but you will definitely benefit from learning some as you go. You will also spend a bit of time learning the DSL that this project has created.

Regardless, this project has enough interest factor for me to play around with someday.