packages feed

tasty-bdd-0.1.0.1: README.md

[![CircleCI](https://circleci.com/gh/ptek/tasty-bdd/tree/master.svg?style=svg)](https://circleci.com/gh/ptek/tasty-bdd/tree/master)

# Behavior-driven development 

## A [Haskell](https://www.haskell.org/) 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](https://github.com/feuerbach/tasty) test library,  monad parametrized
* Support for [tasty-fail-fast](https://hackage.haskell.org/package/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](https://github.com/phadej/tree-diffdifftree) package 
* Recursive test decorators to prepend or append action to all the tests inside a test tree

## Background

[Behavior Driven Development](https://en.wikipedia.org/wiki/Behavior-driven_development) is a software development process that emerged from test-driven development (TDD) and is based on principles of [Hoare Logic](https://en.wikipedia.org/wiki/Hoare_logic). The process requires a strict structure of the tests - {Given} When {Then} - to make them understandable.

## Example

```haskell
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
```