tasty-bdd: BDD tests language and tasty provider

[ bsd3, library, test ] [ Propose Tags ]
Versions [RSS],
Dependencies base (>=4.7 && <5), exceptions, free, HUnit, microlens, microlens-th, mtl, pretty, pretty-show, tagged, tasty, tasty-fail-fast, tasty-hunit, temporary, text, transformers, tree-diff [details]
License BSD-3-Clause
Copyright 2017 Paolo Veronelli
Author Paolo Veronelli, Pavlo Kerestey
Maintainer paolo.veronelli@gmail.com
Category Test
Home page https://gitlab.com/devs.global.de/tasty-bdd
Uploaded by PaoloVeronelli at 2020-08-05T10:20:39Z
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 319 total (7 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2020-08-05 [all 1 reports]

Readme for tasty-bdd-

[back to package description]


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


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.


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