@hackage tasty-bdd0.1.0.1

BDD tests language and tasty provider

CircleCI

Behavior-driven development

A Haskell Behavior Driven Development framework featuring:

  • A type constrained language to express
    • Given as ordered preconditions or
    • GivenAndAfter as oredered preconditions with reversed order of teardown actions (sort of resource management)
    • One only When to introduce a last precondition and catch it's output to be fed to
    • Some Then tests that will receive the output of When
  • Support for do notation via free monad for composing givens and thens
  • One monad independent pure interpreter
  • One driver for the great tasty test library, monad parametrized
  • Support for tasty-fail-fast strategy flag which will not execute the teardown actions of the failed test
  • A sophisticated form of value introspection to show the differences on equality failure from tree-diff package
  • Recursive test decorators to prepend or append action to all the tests inside a test tree

Background

Behavior Driven Development is a software development process that emerged from test-driven development (TDD) and is based on principles of Hoare Logic. The process requires a strict structure of the tests - {Given} When {Then} - to make them understandable.

Example

import Test.Tasty.Bdd

tests :: TestTree
tests = testBdd "Test sequence" 
    $ Given (print "Some effect")
    $ Given (print "Another effect")
    $ GivenAndAfter (print "Aquiring resource" >> return "Resource 1")
                    (print . ("Release "++))
    $ GivenAndAfter (print "Aquiring resource" >> return "Resource 2")
                    (print . ("Release "++))
    $ When (print "Action returning" >> return ([1..10]++[100..106]) :: IO [Int])
    $ Then (@?= ([1..10]++[700..706]))
    $ End